Decompiled source of ChebsMythicalWeapons v4.4.0

plugins/ChebsMythicalWeapons.dll

Decompiled 4 months 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ChebsMythicalWeapons.Creatures;
using ChebsMythicalWeapons.Items;
using ChebsMythicalWeapons.Locations;
using ChebsMythicalWeapons.Pickables;
using ChebsValheimLibrary;
using ChebsValheimLibrary.Common;
using ChebsValheimLibrary.Items;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ChebsMythicalWeapons")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChebsMythicalWeapons")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("4.4.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.4.0.0")]
[module: UnverifiableCode]
namespace ChebsMythicalWeapons
{
	[BepInPlugin("com.chebgonaz.chebsmythicalweapons", "ChebsMythicalWeapons", "4.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	internal class ChebsMythicalWeapons : BaseUnityPlugin
	{
		public const string PluginGuid = "com.chebgonaz.chebsmythicalweapons";

		public const string PluginName = "ChebsMythicalWeapons";

		public const string PluginVersion = "4.4.0";

		private const string ConfigFileName = "com.chebgonaz.chebsmythicalweapons.cfg";

		private static readonly string ConfigFileFullPath = Path.Combine(Paths.ConfigPath, "com.chebgonaz.chebsmythicalweapons.cfg");

		public readonly Version ChebsValheimLibraryVersion = new Version("2.5.2");

		private readonly Harmony _harmony = new Harmony("com.chebgonaz.chebsmythicalweapons");

		public static ConfigEntry<bool> RadeonFriendly;

		public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

		public static ExcaliburItem Excalibur = new ExcaliburItem();

		public static ApolloBowItem ApolloBow = new ApolloBowItem();

		public static SunArrowItem SunArrow = new SunArrowItem();

		public static BladeOfOlympusItem BladeOfOlympus = new BladeOfOlympusItem();

		public static GreatswordOfOlympusItem GreatswordOfOlympus = new GreatswordOfOlympusItem();

		public static JoyceItem Joyce = new JoyceItem();

		public static AegisItem Aegis = new AegisItem();

		private void Awake()
		{
			string text = default(string);
			if (!Base.VersionCheck(ChebsValheimLibraryVersion, ref text))
			{
				Logger.LogWarning((object)text);
			}
			CreateConfigValues();
			LoadAssetBundle();
			_harmony.PatchAll();
			SynchronizationManager.OnConfigurationSynchronized += delegate(object obj, ConfigurationSynchronizationEventArgs attr)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)((!attr.InitialSynchronization) ? "Syncing configuration changes from server..." : "Syncing initial configuration..."));
			};
			((MonoBehaviour)this).StartCoroutine(WatchConfigFile());
		}

		private byte[] GetFileHash(string fileName)
		{
			HashAlgorithm hashAlgorithm = HashAlgorithm.Create();
			using FileStream inputStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
			return hashAlgorithm.ComputeHash(inputStream);
		}

		private IEnumerator WatchConfigFile()
		{
			byte[] lastHash = GetFileHash(ConfigFileFullPath);
			while (true)
			{
				yield return (object)new WaitForSeconds(5f);
				byte[] fileHash = GetFileHash(ConfigFileFullPath);
				if (!fileHash.SequenceEqual(lastHash))
				{
					lastHash = fileHash;
					ReadConfigValues();
				}
			}
		}

		private void ReadConfigValues()
		{
			try
			{
				bool flag = ZNetExtension.IsServerInstance(ZNet.instance) || ZNetExtension.IsLocalInstance(ZNet.instance);
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Read updated config values (admin/local={flag})");
				if (flag)
				{
					((BaseUnityPlugin)this).Config.Reload();
				}
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)string.Format("There was an issue loading your {0}: {1}", "com.chebgonaz.chebsmythicalweapons.cfg", arg));
			}
		}

		private void CreateConfigValues()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			RadeonFriendly = ((BaseUnityPlugin)this).Config.Bind<bool>(((object)this).GetType().Name + " (Client)", "RadeonFriendly", false, new ConfigDescription("ONLY set this to true if you have graphical issues with the mod. It will disable all particle effects for the mod's prefabs which seem to give users with Radeon cards trouble for unknown reasons. If you have problems with lag it might also help to switchthis setting on.", (AcceptableValueBase)null, Array.Empty<object>()));
			SwordInTheStoneLocation.CreateConfigs((BaseUnityPlugin)(object)this);
			((Item)Excalibur).CreateConfigs((BaseUnityPlugin)(object)this);
			ApolloStatueLocation.CreateConfigs((BaseUnityPlugin)(object)this);
			((Item)ApolloBow).CreateConfigs((BaseUnityPlugin)(object)this);
			((Item)SunArrow).CreateConfigs((BaseUnityPlugin)(object)this);
			((Item)BladeOfOlympus).CreateConfigs((BaseUnityPlugin)(object)this);
			((Item)GreatswordOfOlympus).CreateConfigs((BaseUnityPlugin)(object)this);
			((Item)Joyce).CreateConfigs((BaseUnityPlugin)(object)this);
			MinotaurCreature.CreateConfigs((BaseUnityPlugin)(object)this);
			((Item)Aegis).CreateConfigs((BaseUnityPlugin)(object)this);
		}

		private void LoadAssetBundle()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Expected O, but got Unknown
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Expected O, but got Unknown
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Expected O, but got Unknown
			AssetBundle val = AssetUtils.LoadAssetBundle(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "chebsmythicalweapons"));
			try
			{
				GameObject val2 = Base.LoadPrefabFromBundle(((Item)Excalibur).PrefabName, val, RadeonFriendly.Value);
				ItemManager.Instance.AddItem(((Item)Excalibur).GetCustomItemFromPrefab(val2));
				GameObject val3 = val.LoadAsset<GameObject>("ChebGonaz_SwordInTheStonePickable.prefab");
				val3.AddComponent<SwordInTheStonePickable>();
				PrefabManager.Instance.AddPrefab(val3);
				GameObject obj = val.LoadAsset<GameObject>("ChebGonaz_SwordInTheStone.prefab");
				obj.AddComponent<SwordInTheStoneLocation>();
				LocationConfig val4 = new LocationConfig
				{
					Biome = SwordInTheStoneLocation.Biome.Value,
					Quantity = SwordInTheStoneLocation.Quantity.Value,
					Priotized = true,
					ExteriorRadius = 2f,
					ClearArea = true
				};
				CustomLocation val5 = new CustomLocation(obj, false, val4);
				ZoneManager.Instance.AddCustomLocation(val5);
				GameObject val6 = Base.LoadPrefabFromBundle(((Item)ApolloBow).PrefabName, val, RadeonFriendly.Value);
				ItemManager.Instance.AddItem(((Item)ApolloBow).GetCustomItemFromPrefab(val6));
				GameObject val7 = val.LoadAsset<GameObject>("ChebGonaz_ApolloStatuePickable.prefab");
				val7.AddComponent<ApolloStatuePickable>();
				PrefabManager.Instance.AddPrefab(val7);
				GameObject obj2 = val.LoadAsset<GameObject>("ChebGonaz_ApolloStatueLocation.prefab");
				obj2.AddComponent<ApolloStatueLocation>();
				LocationConfig val8 = new LocationConfig
				{
					Biome = ApolloStatueLocation.Biome.Value,
					Quantity = ApolloStatueLocation.Quantity.Value,
					Priotized = true,
					ExteriorRadius = 2f,
					ClearArea = true
				};
				CustomLocation val9 = new CustomLocation(obj2, false, val8);
				ZoneManager.Instance.AddCustomLocation(val9);
				GameObject val10 = Base.LoadPrefabFromBundle(((Item)SunArrow).PrefabName, val, RadeonFriendly.Value);
				ItemManager.Instance.AddItem(((Item)SunArrow).GetCustomItemFromPrefab(val10));
				GameObject val11 = Base.LoadPrefabFromBundle(((Item)BladeOfOlympus).PrefabName, val, RadeonFriendly.Value);
				ItemManager.Instance.AddItem(((Item)BladeOfOlympus).GetCustomItemFromPrefab(val11));
				GameObject val12 = Base.LoadPrefabFromBundle(((Item)GreatswordOfOlympus).PrefabName, val, RadeonFriendly.Value);
				ItemManager.Instance.AddItem(((Item)GreatswordOfOlympus).GetCustomItemFromPrefab(val12));
				GameObject val13 = Base.LoadPrefabFromBundle(((Item)Joyce).PrefabName, val, RadeonFriendly.Value);
				ItemManager.Instance.AddItem(((Item)Joyce).GetCustomItemFromPrefab(val13));
				GameObject obj3 = Base.LoadPrefabFromBundle("ChebGonaz_Minotaur.prefab", val, RadeonFriendly.Value);
				obj3.AddComponent<MinotaurCreature>();
				CreatureConfig val14 = new CreatureConfig
				{
					Name = MinotaurCreature.LocalizedName,
					Faction = MinotaurCreature.Faction.Value
				};
				val14.AddSpawnConfig(new SpawnConfig
				{
					SpawnChance = MinotaurCreature.SpawnChance.Value,
					SpawnInterval = MinotaurCreature.SpawnInterval.Value,
					SpawnDistance = MinotaurCreature.SpawnDistance.Value,
					MaxSpawned = MinotaurCreature.MaxSpawned.Value,
					Biome = MinotaurCreature.Biome.Value
				});
				CustomCreature val15 = new CustomCreature(obj3, true, val14);
				Humanoid val16 = default(Humanoid);
				if (obj3.TryGetComponent<Humanoid>(ref val16))
				{
					((Character)val16).m_health = MinotaurCreature.Health.Value;
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"Failed to set minotaur health (no humanoid component)");
				}
				CreatureManager.Instance.AddCreature(val15);
				GameObject val17 = Base.LoadPrefabFromBundle(((Item)Aegis).PrefabName, val, RadeonFriendly.Value);
				ItemManager.Instance.AddItem(((Item)Aegis).GetCustomItemFromPrefab(val17));
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while loading assets: {arg}");
			}
			finally
			{
				val.Unload(false);
			}
		}
	}
}
namespace ChebsMythicalWeapons.Pickables
{
	public class ApolloStatuePickable : MonoBehaviour
	{
		public const string PickablePrefabName = "ChebGonaz_ApolloStatuePickable.prefab";
	}
	public class SwordInTheStonePickable : MonoBehaviour
	{
		public const string PickablePrefabName = "ChebGonaz_SwordInTheStonePickable.prefab";
	}
}
namespace ChebsMythicalWeapons.Patches
{
	[HarmonyPatch(typeof(Attack))]
	public class AttackPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch("FireProjectileBurst")]
		private static void FireProjectileBurst(Attack __instance)
		{
			GameObject val = __instance?.m_weapon?.m_lastProjectile;
			if (!((Object)(object)val == (Object)null))
			{
				GameObject val2 = __instance.m_weapon?.m_dropPrefab;
				if ((Object)(object)val2 != (Object)null && ((Object)val2).name.Equals(((Item)ChebsMythicalWeapons.ApolloBow).ItemName))
				{
					val.GetComponent<Projectile>().m_gravity = ApolloBowItem.ProjectileGravity.Value;
				}
			}
		}
	}
	[HarmonyPatch(typeof(InventoryGui))]
	public class InventoryGuiPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetRecipe")]
		private static void SetRecipe(InventoryGui __instance, int index, bool center)
		{
			//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)
			//IL_009d: 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_00ae: Expected O, but got Unknown
			//IL_00c7: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0110: 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_012f: 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_0140: Expected O, but got Unknown
			if (!__instance.InUpradeTab())
			{
				return;
			}
			string text = ((object)__instance.m_selectedRecipe.Key).ToString();
			if (text.Contains(((Item)ChebsMythicalWeapons.Excalibur).ItemName) || text.Contains(((Item)ChebsMythicalWeapons.ApolloBow).ItemName))
			{
				int quality = __instance.m_selectedRecipe.Value.m_quality;
				switch (quality)
				{
				case 1:
					__instance.m_selectedRecipe.Key.m_resources = (Requirement[])(object)new Requirement[1]
					{
						new Requirement
						{
							m_resItem = PrefabManager.Instance.GetPrefab("Iron").GetComponent<ItemDrop>(),
							m_amount = 40,
							m_amountPerLevel = 40
						}
					};
					break;
				case 2:
					__instance.m_selectedRecipe.Key.m_resources = (Requirement[])(object)new Requirement[1]
					{
						new Requirement
						{
							m_resItem = PrefabManager.Instance.GetPrefab("Silver").GetComponent<ItemDrop>(),
							m_amount = 40,
							m_amountPerLevel = 20
						}
					};
					break;
				case 3:
					__instance.m_selectedRecipe.Key.m_resources = (Requirement[])(object)new Requirement[1]
					{
						new Requirement
						{
							m_resItem = PrefabManager.Instance.GetPrefab("BlackMetal").GetComponent<ItemDrop>(),
							m_amount = 40,
							m_amountPerLevel = 13
						}
					};
					break;
				default:
					Logger.LogWarning((object)$"Unhandled case in recipes (quality = {quality} for Excalibur), please tell Cheb.");
					break;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("UpdateRecipeList")]
		private static void UpdateRecipeList(InventoryGui __instance, ref List<Recipe> recipes)
		{
			//IL_0017: 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)
			EnvSetup currentEnvironment = EnvMan.instance.GetCurrentEnvironment();
			bool thunderstormActive = (int)BladeOfOlympusItem.CraftingWeatherCondition.Value == 0 || currentEnvironment.m_name == InternalName.GetName((Enum)(object)BladeOfOlympusItem.CraftingWeatherCondition.Value);
			if (__instance.InCraftTab())
			{
				recipes.RemoveAll(delegate(Recipe recipe)
				{
					string text = ((object)recipe).ToString();
					return text.Contains(((Item)ChebsMythicalWeapons.Excalibur).ItemName) || text.Contains(((Item)ChebsMythicalWeapons.ApolloBow).ItemName) || text.Contains(((Item)ChebsMythicalWeapons.Joyce).ItemName) || text.Contains(((Item)ChebsMythicalWeapons.Aegis).ItemName) || (!thunderstormActive && (text.Contains(((Item)ChebsMythicalWeapons.BladeOfOlympus).ItemName) || text.Contains(((Item)ChebsMythicalWeapons.GreatswordOfOlympus).ItemName)));
				});
			}
		}
	}
	[HarmonyPatch(typeof(Pickable))]
	public class PickablePatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void AwakePrefix(Pickable __instance)
		{
			if (((Object)__instance).name.StartsWith("ChebGonaz_SwordInTheStonePickable.prefab".Substring(0, "ChebGonaz_SwordInTheStonePickable.prefab".Length - 7)))
			{
				((Component)__instance).gameObject.AddComponent<SwordInTheStonePickable>();
			}
			else if (((Object)__instance).name.StartsWith("ChebGonaz_ApolloStatuePickable.prefab".Substring(0, "ChebGonaz_ApolloStatuePickable.prefab".Length - 7)))
			{
				((Component)__instance).gameObject.AddComponent<ApolloStatuePickable>();
			}
		}

		[HarmonyPatch("Interact")]
		[HarmonyPrefix]
		private static bool Interact(Pickable __instance, Humanoid character, bool repeat, bool alt)
		{
			ApolloStatuePickable apolloStatuePickable = default(ApolloStatuePickable);
			SwordInTheStonePickable swordInTheStonePickable = default(SwordInTheStonePickable);
			if (((Component)__instance).TryGetComponent<ApolloStatuePickable>(ref apolloStatuePickable))
			{
				Player player = Player.GetPlayer(Game.instance.GetPlayerProfile().GetPlayerID());
				if ((Object)(object)player == (Object)null)
				{
					Logger.LogError((object)"ApolloStatue: Failed to get player");
					return false;
				}
				if (((Character)player).GetSkillLevel((SkillType)8) < (float)ApolloStatueLocation.BowSkillRequired.Value)
				{
					((Character)character).Message((MessageType)2, "$chebgonaz_apollo_unworthy", 0, (Sprite)null);
					return false;
				}
			}
			else if (((Component)__instance).TryGetComponent<SwordInTheStonePickable>(ref swordInTheStonePickable))
			{
				Player player2 = Player.GetPlayer(Game.instance.GetPlayerProfile().GetPlayerID());
				if ((Object)(object)player2 == (Object)null)
				{
					Logger.LogError((object)"SwordInTheStone: Failed to get player");
					return false;
				}
				if (((Character)player2).GetSkillLevel((SkillType)1) < (float)SwordInTheStoneLocation.SwordSkillRequired.Value)
				{
					((Character)character).Message((MessageType)2, "$chebgonaz_swordinthestone_unworthy", 0, (Sprite)null);
					return false;
				}
			}
			return true;
		}
	}
}
namespace ChebsMythicalWeapons.Locations
{
	public class ApolloStatueLocation : MonoBehaviour
	{
		public const string PrefabName = "ChebGonaz_ApolloStatueLocation.prefab";

		public const string NameLocalization = "$chebgonaz_apollostatue";

		public static ConfigEntry<Biome> Biome;

		public static ConfigEntry<PinType> MapMarker;

		public static ConfigEntry<int> Quantity;

		public static ConfigEntry<int> BowSkillRequired;

		public static void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_004c: 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_0059: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//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_0094: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			MapMarker = plugin.Config.Bind<PinType>("ApolloStatueLocation (Client)", "MapMarker", (PinType)9, new ConfigDescription("The type of map marker shown (set to None to disable).", (AcceptableValueBase)null, Array.Empty<object>()));
			Quantity = plugin.Config.Bind<int>("ApolloStatueLocation (Server Synced)", "ApolloBowQuantity", 30, new ConfigDescription("The amount of Statue of Apollo locations in the world.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Biome = plugin.Config.Bind<Biome>("ApolloStatueLocation (Server Synced)", "ApolloBowLocationBiome", (Biome)1, new ConfigDescription("The biome in which a Statue of Apollo can appear.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BowSkillRequired = plugin.Config.Bind<int>("ApolloStatueLocation (Server Synced)", "BowSkillRequired", 100, new ConfigDescription("The bow skill required to take Apollo's Bow from the statue.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_0038: 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)
			Logger.LogInfo((object)$"Awakening at {((Component)this).transform.position}");
			if ((int)MapMarker.Value != 8)
			{
				Minimap.instance.AddPin(((Component)this).transform.position, MapMarker.Value, ChebsMythicalWeapons.Localization.TryTranslate("$chebgonaz_apollostatue"), true, false, Game.instance.GetPlayerProfile().GetPlayerID(), "");
			}
		}
	}
	public class SwordInTheStoneLocation : MonoBehaviour
	{
		public const string PrefabName = "ChebGonaz_SwordInTheStone.prefab";

		public const string NameLocalization = "$chebgonaz_swordinthestone";

		public static ConfigEntry<Biome> Biome;

		public static ConfigEntry<PinType> MapMarker;

		public static ConfigEntry<int> Quantity;

		public static ConfigEntry<int> SwordSkillRequired;

		public static void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_004c: 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_0059: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//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_0094: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			MapMarker = plugin.Config.Bind<PinType>("SwordInTheStoneLocation (Client)", "MapMarker", (PinType)9, new ConfigDescription("The type of map marker shown (set to None to disable).", (AcceptableValueBase)null, Array.Empty<object>()));
			Quantity = plugin.Config.Bind<int>("SwordInTheStoneLocation (Server Synced)", "Quantity", 30, new ConfigDescription("The amount of Sword in the Stone locations in the world.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Biome = plugin.Config.Bind<Biome>("SwordInTheStoneLocation (Server Synced)", "Biome", (Biome)1, new ConfigDescription("The biome in which a Sword in the Stone can appear.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SwordSkillRequired = plugin.Config.Bind<int>("SwordInTheStoneLocation (Server Synced)", "SwordSkillRequired", 100, new ConfigDescription("The sword skill required to take Excalibur out of the stone.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_0038: 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)
			Logger.LogInfo((object)$"Awakening at {((Component)this).transform.position}");
			if ((int)MapMarker.Value != 8)
			{
				Minimap.instance.AddPin(((Component)this).transform.position, MapMarker.Value, ChebsMythicalWeapons.Localization.TryTranslate("$chebgonaz_swordinthestone"), true, false, Game.instance.GetPlayerProfile().GetPlayerID(), "");
			}
		}
	}
}
namespace ChebsMythicalWeapons.Items
{
	public class AegisItem : Item
	{
		public static ConfigEntry<float> BlockPower;

		public static ConfigEntry<float> BlockPowerPerLevel;

		public static ConfigEntry<float> DeflectionForce;

		public static ConfigEntry<float> DeflectionForcePerLevel;

		public override string ItemName => "ChebGonaz_Aegis";

		public override string PrefabName => "ChebGonaz_Aegis.prefab";

		public override string NameLocalization => "$chebgonaz_aegis";

		public override string DescriptionLocalization => "$chebgonaz_aegis_desc";

		public override void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00d1: 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_00de: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			BlockPower = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPower", 70f, new ConfigDescription("Aegis's base blocking power.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPowerPerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPowerPerLevel", 0f, new ConfigDescription("Aegis's blocking power increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForce = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForce", 50f, new ConfigDescription("Aegis's base deflection force.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForcePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForcePerLevel", 0f, new ConfigDescription("Aegis's deflection force increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		public override CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0059: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			ItemConfig val = new ItemConfig();
			val.Name = ((Item)this).NameLocalization;
			val.Description = ((Item)this).DescriptionLocalization;
			val.CraftingStation = InternalName.GetName((Enum)(object)(CraftingTable)3);
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Amount = 20,
					AmountPerLevel = 20,
					Item = "Silver"
				}
			};
			ItemConfig val2 = val;
			CustomItem val3 = new CustomItem(prefab, false, val2);
			if ((Object)(object)val3.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + ((Item)this).PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			SharedData shared = val3.ItemDrop.m_itemData.m_shared;
			shared.m_blockPower = BlockPower.Value;
			shared.m_blockPowerPerLevel = BlockPowerPerLevel.Value;
			shared.m_deflectionForce = DeflectionForce.Value;
			shared.m_deflectionForcePerLevel = DeflectionForcePerLevel.Value;
			return val3;
		}
	}
	public class ApolloBowItem : Item
	{
		public static ConfigEntry<float> ProjectileGravity;

		public static ConfigEntry<float> ProjectileVelocity;

		public static ConfigEntry<float> ProjectileVelocityMin;

		public static ConfigEntry<float> ProjectileAccuracy;

		public static ConfigEntry<float> ProjectileAccuracyMin;

		public static ConfigEntry<float> Knockback;

		public static ConfigEntry<float> BackstabBonus;

		public static ConfigEntry<float> PiercingDamage;

		public static ConfigEntry<float> FireDamage;

		public static ConfigEntry<float> BonusPiercingDamagePerLevel;

		public static ConfigEntry<float> BonusFireDamagePerLevel;

		public override string ItemName => "ChebGonaz_BowOfApollo";

		public override string PrefabName => "ChebGonaz_BowOfApollo.prefab";

		public override string NameLocalization => "$chebgonaz_bowofapollo";

		public override string DescriptionLocalization => "$chebgonaz_bowofapollo_desc";

		public override void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00d1: 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_00de: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Expected O, but got Unknown
			//IL_025c: 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_0269: Expected O, but got Unknown
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Expected O, but got Unknown
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Expected O, but got Unknown
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Expected O, but got Unknown
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Expected O, but got Unknown
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Expected O, but got Unknown
			Knockback = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "Knockback", 35f, new ConfigDescription("Bow's base knockback value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BackstabBonus = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BackstabBonus", 3f, new ConfigDescription("Bow's base backstab value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			PiercingDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "PiercingDamage", 80f, new ConfigDescription("Bow's base piercing damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			FireDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "FireDamage", 40f, new ConfigDescription("Bow's base fire damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusPiercingDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusPiercingDamagePerLevel", 10f, new ConfigDescription("Bow's piercing damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusFireDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusFireDamagePerLevel", 0f, new ConfigDescription("Bow's fire damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			ProjectileGravity = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "ProjectileGravity", 5f, new ConfigDescription("Replace projectile gravity for projectiles leaving the bow to manipulate the drop. For an arrow that flies straight and true, use 0; for default arrow behaviour, use 5. This, along with projectile velocity, influences the drop of the arrow as it flies.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			ProjectileVelocity = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "ProjectileVelocity", 60f, new ConfigDescription("Bow's projectile velocity value. This is the speed of the projectile when it leaves the bow. This, along with projectile gravity, influences the drop of the arrow as it flies.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			ProjectileVelocityMin = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "ProjectileVelocityMin", 2f, new ConfigDescription("Bow's projectile velocity min value (I don't know what this does).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			ProjectileAccuracy = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "ProjectileAccuracy", 0f, new ConfigDescription("Bow's projectile accuracy value (I don't know what this does).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			ProjectileAccuracyMin = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "ProjectileAccuracyMin", 20f, new ConfigDescription("Bow's projectile accuracy min value (I don't know what this does).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		public override CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0059: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			ItemConfig val = new ItemConfig();
			val.Name = ((Item)this).NameLocalization;
			val.Description = ((Item)this).DescriptionLocalization;
			val.CraftingStation = InternalName.GetName((Enum)(object)(CraftingTable)3);
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Amount = 20,
					AmountPerLevel = 20,
					Item = "Silver"
				}
			};
			ItemConfig val2 = val;
			CustomItem val3 = new CustomItem(prefab, false, val2);
			if ((Object)(object)val3.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + ((Item)this).PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			SharedData shared = val3.ItemDrop.m_itemData.m_shared;
			shared.m_attackForce = Knockback.Value;
			shared.m_backstabBonus = BackstabBonus.Value;
			shared.m_damages.m_pierce = PiercingDamage.Value;
			shared.m_damages.m_fire = FireDamage.Value;
			shared.m_damagesPerLevel.m_pierce = BonusPiercingDamagePerLevel.Value;
			shared.m_damagesPerLevel.m_fire = BonusFireDamagePerLevel.Value;
			shared.m_attack.m_projectileVel = ProjectileVelocity.Value;
			shared.m_attack.m_projectileVelMin = ProjectileVelocityMin.Value;
			shared.m_attack.m_projectileAccuracy = ProjectileAccuracy.Value;
			shared.m_attack.m_projectileAccuracyMin = ProjectileAccuracyMin.Value;
			return val3;
		}
	}
	public class BladeOfOlympusItem : Item
	{
		public static ConfigEntry<CraftingTable> CraftingStationRequired;

		public static ConfigEntry<int> CraftingStationLevel;

		public static ConfigEntry<string> CraftingCost;

		public static ConfigEntry<Env> CraftingWeatherCondition;

		public static ConfigEntry<float> Knockback;

		public static ConfigEntry<float> BackstabBonus;

		public static ConfigEntry<float> SlashDamage;

		public static ConfigEntry<float> LightningDamage;

		public static ConfigEntry<float> BonusSlashDamagePerLevel;

		public static ConfigEntry<float> BonusLightningDamagePerLevel;

		public static ConfigEntry<float> BlockPower;

		public static ConfigEntry<float> BlockPowerPerLevel;

		public static ConfigEntry<float> DeflectionForce;

		public static ConfigEntry<float> DeflectionForcePerLevel;

		public override string ItemName => "ChebGonaz_BladeOfOlympus";

		public override string PrefabName => "ChebGonaz_BladeOfOlympus.prefab";

		public override string NameLocalization => "$chebgonaz_bladeofolympus";

		public override string DescriptionLocalization => "$chebgonaz_bladeofolympus_desc";

		protected override string DefaultRecipe => "Flametal:20,Silver:20,BlackMetal:20,FineWood:20";

		public override void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Expected O, but got Unknown
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Expected O, but got Unknown
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02f6: 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)
			//IL_0303: Expected O, but got Unknown
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Expected O, but got Unknown
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Expected O, but got Unknown
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Expected O, but got Unknown
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Expected O, but got Unknown
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Expected O, but got Unknown
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Expected O, but got Unknown
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Expected O, but got Unknown
			CraftingStationRequired = plugin.Config.Bind<CraftingTable>(((object)this).GetType().Name + " (Server Synced)", "CraftingStation", (CraftingTable)6, new ConfigDescription("Crafting station where it's available", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingStationLevel = plugin.Config.Bind<int>(((object)this).GetType().Name + " (Server Synced)", "CraftingStationLevel", 1, new ConfigDescription("Crafting station level required to craft", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingCost = plugin.Config.Bind<string>(((object)this).GetType().Name + " (Server Synced)", "CraftingCosts", ((Item)this).DefaultRecipe, new ConfigDescription("Materials needed to craft it. None or Blank will use Default settings.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingWeatherCondition = plugin.Config.Bind<Env>(((object)this).GetType().Name + " (Server Synced)", "CraftingWeatherCondition", (Env)14, new ConfigDescription("The weather event required to forge the blade. Set to None to craft under any weather conditions.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Knockback = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "Knockback", 50f, new ConfigDescription("BladeOfOlympus's base knockback value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BackstabBonus = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BackstabBonus", 3f, new ConfigDescription("BladeOfOlympus's base backstab value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SlashDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "SlashDamage", 100f, new ConfigDescription("BladeOfOlympus's base slash damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			LightningDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "LightningDamage", 50f, new ConfigDescription("BladeOfOlympus's base spirit damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusSlashDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusSlashDamagePerLevel", 20f, new ConfigDescription("BladeOfOlympus's slash damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusLightningDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusLightningDamagePerLevel", 0f, new ConfigDescription("BladeOfOlympus's spirit damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPower = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPower", 43f, new ConfigDescription("BladeOfOlympus's base blocking power.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPowerPerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPowerPerLevel", 0f, new ConfigDescription("BladeOfOlympus's blocking power increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForce = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForce", 43f, new ConfigDescription("BladeOfOlympus's base deflection force.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForcePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForcePerLevel", 0f, new ConfigDescription("BladeOfOlympus's deflection force increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		public override void UpdateRecipe()
		{
			((Item)this).UpdateRecipe(CraftingStationRequired, CraftingCost, CraftingStationLevel);
		}

		public override CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			ItemConfig val = new ItemConfig
			{
				Name = ((Item)this).NameLocalization,
				Description = ((Item)this).DescriptionLocalization
			};
			if (string.IsNullOrEmpty(CraftingCost.Value))
			{
				CraftingCost.Value = ((Item)this).DefaultRecipe;
			}
			((Item)this).SetRecipeReqs(val, CraftingCost, CraftingStationRequired, CraftingStationLevel);
			CustomItem val2 = new CustomItem(prefab, false, val);
			if ((Object)(object)val2.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + ((Item)this).PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			SharedData shared = val2.ItemDrop.m_itemData.m_shared;
			shared.m_attackForce = Knockback.Value;
			shared.m_backstabBonus = BackstabBonus.Value;
			shared.m_damages.m_slash = SlashDamage.Value;
			shared.m_damages.m_lightning = LightningDamage.Value;
			shared.m_damagesPerLevel.m_slash = BonusSlashDamagePerLevel.Value;
			shared.m_damagesPerLevel.m_lightning = BonusLightningDamagePerLevel.Value;
			shared.m_blockPower = BlockPower.Value;
			shared.m_blockPowerPerLevel = BlockPowerPerLevel.Value;
			shared.m_deflectionForce = DeflectionForce.Value;
			shared.m_deflectionForcePerLevel = DeflectionForcePerLevel.Value;
			return val2;
		}
	}
	public class ExcaliburItem : Item
	{
		public static ConfigEntry<float> Knockback;

		public static ConfigEntry<float> BackstabBonus;

		public static ConfigEntry<float> SlashDamage;

		public static ConfigEntry<float> SpiritDamage;

		public static ConfigEntry<float> BonusSlashDamagePerLevel;

		public static ConfigEntry<float> BonusSpiritDamagePerLevel;

		public static ConfigEntry<float> BlockPower;

		public static ConfigEntry<float> BlockPowerPerLevel;

		public static ConfigEntry<float> DeflectionForce;

		public static ConfigEntry<float> DeflectionForcePerLevel;

		public override string ItemName => "ChebGonaz_Excalibur";

		public override string PrefabName => "ChebGonaz_Excalibur.prefab";

		public override string NameLocalization => "$chebgonaz_excalibur";

		public override string DescriptionLocalization => "$chebgonaz_excalibur_desc";

		public override void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00d1: 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_00de: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Expected O, but got Unknown
			//IL_025c: 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_0269: Expected O, but got Unknown
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Expected O, but got Unknown
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Expected O, but got Unknown
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Expected O, but got Unknown
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			Knockback = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "Knockback", 50f, new ConfigDescription("Excalibur's base knockback value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BackstabBonus = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BackstabBonus", 3f, new ConfigDescription("Excalibur's base backstab value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SlashDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "SlashDamage", 100f, new ConfigDescription("Excalibur's base slash damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SpiritDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "SpiritDamage", 50f, new ConfigDescription("Excalibur's base spirit damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusSlashDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusSlashDamagePerLevel", 20f, new ConfigDescription("Excalibur's slash damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusSpiritDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusSpiritDamagePerLevel", 0f, new ConfigDescription("Excalibur's spirit damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPower = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPower", 43f, new ConfigDescription("Excalibur's base blocking power.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPowerPerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPowerPerLevel", 0f, new ConfigDescription("Excalibur's blocking power increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForce = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForce", 43f, new ConfigDescription("Excalibur's base deflection force.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForcePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForcePerLevel", 0f, new ConfigDescription("Excalibur's deflection force increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		public override CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0059: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			ItemConfig val = new ItemConfig();
			val.Name = ((Item)this).NameLocalization;
			val.Description = ((Item)this).DescriptionLocalization;
			val.CraftingStation = InternalName.GetName((Enum)(object)(CraftingTable)3);
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Amount = 20,
					AmountPerLevel = 20,
					Item = "Silver"
				}
			};
			ItemConfig val2 = val;
			CustomItem val3 = new CustomItem(prefab, false, val2);
			if ((Object)(object)val3.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + ((Item)this).PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			SharedData shared = val3.ItemDrop.m_itemData.m_shared;
			shared.m_attackForce = Knockback.Value;
			shared.m_backstabBonus = BackstabBonus.Value;
			shared.m_damages.m_slash = SlashDamage.Value;
			shared.m_damages.m_spirit = SpiritDamage.Value;
			shared.m_damagesPerLevel.m_slash = BonusSlashDamagePerLevel.Value;
			shared.m_damagesPerLevel.m_spirit = BonusSpiritDamagePerLevel.Value;
			shared.m_blockPower = BlockPower.Value;
			shared.m_blockPowerPerLevel = BlockPowerPerLevel.Value;
			shared.m_deflectionForce = DeflectionForce.Value;
			shared.m_deflectionForcePerLevel = DeflectionForcePerLevel.Value;
			return val3;
		}
	}
	public class GreatswordOfOlympusItem : Item
	{
		public static ConfigEntry<CraftingTable> CraftingStationRequired;

		public static ConfigEntry<int> CraftingStationLevel;

		public static ConfigEntry<string> CraftingCost;

		public static ConfigEntry<Env> CraftingWeatherCondition;

		public static ConfigEntry<float> Knockback;

		public static ConfigEntry<float> BackstabBonus;

		public static ConfigEntry<float> SlashDamage;

		public static ConfigEntry<float> LightningDamage;

		public static ConfigEntry<float> BonusSlashDamagePerLevel;

		public static ConfigEntry<float> BonusLightningDamagePerLevel;

		public static ConfigEntry<float> BlockPower;

		public static ConfigEntry<float> BlockPowerPerLevel;

		public static ConfigEntry<float> DeflectionForce;

		public static ConfigEntry<float> DeflectionForcePerLevel;

		public override string ItemName => "ChebGonaz_GreatswordOfOlympus";

		public override string PrefabName => "ChebGonaz_GreatswordOfOlympus.prefab";

		public override string NameLocalization => "$chebgonaz_greatswordofolympus";

		public override string DescriptionLocalization => "$chebgonaz_greatswordofolympus_desc";

		protected override string DefaultRecipe => "Flametal:20,Silver:20,BlackMetal:20,FineWood:20";

		public override void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Expected O, but got Unknown
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Expected O, but got Unknown
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02f6: 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)
			//IL_0303: Expected O, but got Unknown
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Expected O, but got Unknown
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Expected O, but got Unknown
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Expected O, but got Unknown
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Expected O, but got Unknown
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Expected O, but got Unknown
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Expected O, but got Unknown
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Expected O, but got Unknown
			CraftingStationRequired = plugin.Config.Bind<CraftingTable>(((object)this).GetType().Name + " (Server Synced)", "CraftingStation", (CraftingTable)6, new ConfigDescription("Crafting station where it's available", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingStationLevel = plugin.Config.Bind<int>(((object)this).GetType().Name + " (Server Synced)", "CraftingStationLevel", 1, new ConfigDescription("Crafting station level required to craft", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingCost = plugin.Config.Bind<string>(((object)this).GetType().Name + " (Server Synced)", "CraftingCosts", ((Item)this).DefaultRecipe, new ConfigDescription("Materials needed to craft it. None or Blank will use Default settings.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingWeatherCondition = plugin.Config.Bind<Env>(((object)this).GetType().Name + " (Server Synced)", "CraftingWeatherCondition", (Env)14, new ConfigDescription("The weather event required to forge the greatsword. Set to None to craft under any weather conditions.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Knockback = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "Knockback", 75f, new ConfigDescription("GreatswordOfOlympus's base knockback value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BackstabBonus = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BackstabBonus", 3f, new ConfigDescription("GreatswordOfOlympus's base backstab value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SlashDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "SlashDamage", 140f, new ConfigDescription("GreatswordOfOlympus's base slash damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			LightningDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "LightningDamage", 50f, new ConfigDescription("GreatswordOfOlympus's base spirit damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusSlashDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusSlashDamagePerLevel", 25f, new ConfigDescription("GreatswordOfOlympus's slash damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusLightningDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusLightningDamagePerLevel", 0f, new ConfigDescription("GreatswordOfOlympus's spirit damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPower = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPower", 86f, new ConfigDescription("GreatswordOfOlympus's base blocking power.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPowerPerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPowerPerLevel", 0f, new ConfigDescription("GreatswordOfOlympus's blocking power increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForce = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForce", 86f, new ConfigDescription("GreatswordOfOlympus's base deflection force.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForcePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForcePerLevel", 0f, new ConfigDescription("GreatswordOfOlympus's deflection force increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		public override void UpdateRecipe()
		{
			((Item)this).UpdateRecipe(CraftingStationRequired, CraftingCost, CraftingStationLevel);
		}

		public override CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			ItemConfig val = new ItemConfig
			{
				Name = ((Item)this).NameLocalization,
				Description = ((Item)this).DescriptionLocalization
			};
			if (string.IsNullOrEmpty(CraftingCost.Value))
			{
				CraftingCost.Value = ((Item)this).DefaultRecipe;
			}
			((Item)this).SetRecipeReqs(val, CraftingCost, CraftingStationRequired, CraftingStationLevel);
			CustomItem val2 = new CustomItem(prefab, false, val);
			if ((Object)(object)val2.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + ((Item)this).PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			SharedData shared = val2.ItemDrop.m_itemData.m_shared;
			shared.m_attackForce = Knockback.Value;
			shared.m_backstabBonus = BackstabBonus.Value;
			shared.m_damages.m_slash = SlashDamage.Value;
			shared.m_damages.m_lightning = LightningDamage.Value;
			shared.m_damagesPerLevel.m_slash = BonusSlashDamagePerLevel.Value;
			shared.m_damagesPerLevel.m_lightning = BonusLightningDamagePerLevel.Value;
			shared.m_blockPower = BlockPower.Value;
			shared.m_blockPowerPerLevel = BlockPowerPerLevel.Value;
			shared.m_deflectionForce = DeflectionForce.Value;
			shared.m_deflectionForcePerLevel = DeflectionForcePerLevel.Value;
			return val2;
		}
	}
	public class JoyceItem : Item
	{
		public static ConfigEntry<CraftingTable> CraftingStationRequired;

		public static ConfigEntry<float> Knockback;

		public static ConfigEntry<float> BackstabBonus;

		public static ConfigEntry<float> SlashDamage;

		public static ConfigEntry<float> FireDamage;

		public static ConfigEntry<float> ChopDamage;

		public static ConfigEntry<float> BonusSlashDamagePerLevel;

		public static ConfigEntry<float> BonusFireDamagePerLevel;

		public static ConfigEntry<float> BonusChopDamagePerLevel;

		public static ConfigEntry<float> BlockPower;

		public static ConfigEntry<float> BlockPowerPerLevel;

		public static ConfigEntry<float> DeflectionForce;

		public static ConfigEntry<float> DeflectionForcePerLevel;

		public static ConfigEntry<int> ToolTier;

		public override string ItemName => "ChebGonaz_Joyce";

		public override string PrefabName => "ChebGonaz_Joyce.prefab";

		public override string NameLocalization => "$chebgonaz_joyce";

		public override string DescriptionLocalization => "$chebgonaz_joyce_desc";

		public override void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//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)
			//IL_008b: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Expected O, but got Unknown
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Expected O, but got Unknown
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02f6: 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)
			//IL_0303: Expected O, but got Unknown
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Expected O, but got Unknown
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Expected O, but got Unknown
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Expected O, but got Unknown
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Expected O, but got Unknown
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Expected O, but got Unknown
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Expected O, but got Unknown
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Expected O, but got Unknown
			CraftingStationRequired = plugin.Config.Bind<CraftingTable>(((object)this).GetType().Name + " (Server Synced)", "CraftingStation", (CraftingTable)6, new ConfigDescription("Crafting station where it's available", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Knockback = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "Knockback", 50f, new ConfigDescription("Joyce's base knockback value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BackstabBonus = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BackstabBonus", 3f, new ConfigDescription("Joyce's base backstab value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SlashDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "SlashDamage", 100f, new ConfigDescription("Joyce's base slash damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			FireDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "FireDamage", 50f, new ConfigDescription("Joyce's base spirit damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			ChopDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "ChopDamage", 100f, new ConfigDescription("Joyce's base chop damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusSlashDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusSlashDamagePerLevel", 20f, new ConfigDescription("Joyce's slash damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusFireDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusFireDamagePerLevel", 0f, new ConfigDescription("Joyce's spirit damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BonusChopDamagePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BonusChopDamagePerLevel", 20f, new ConfigDescription("Joyce's chop damage increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPower = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPower", 43f, new ConfigDescription("Joyce's base blocking power.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			BlockPowerPerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "BlockPowerPerLevel", 0f, new ConfigDescription("Joyce's blocking power increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForce = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForce", 43f, new ConfigDescription("Joyce's base deflection force.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			DeflectionForcePerLevel = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "DeflectionForcePerLevel", 0f, new ConfigDescription("Joyce's deflection force increase per level.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			ToolTier = plugin.Config.Bind<int>(((object)this).GetType().Name + " (Server Synced)", "ToolTier", 4, new ConfigDescription("Joyce's tool tier level (determines what can be cut eg. 4 = black metal axe).", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		public override CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0059: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			ItemConfig val = new ItemConfig();
			val.Name = ((Item)this).NameLocalization;
			val.Description = ((Item)this).DescriptionLocalization;
			val.CraftingStation = InternalName.GetName((Enum)(object)(CraftingTable)3);
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Amount = 20,
					AmountPerLevel = 20,
					Item = "Silver"
				}
			};
			ItemConfig val2 = val;
			CustomItem val3 = new CustomItem(prefab, false, val2);
			if ((Object)(object)val3.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + ((Item)this).PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			SharedData shared = val3.ItemDrop.m_itemData.m_shared;
			shared.m_attackForce = Knockback.Value;
			shared.m_backstabBonus = BackstabBonus.Value;
			shared.m_damages.m_slash = SlashDamage.Value;
			shared.m_damages.m_fire = FireDamage.Value;
			shared.m_damagesPerLevel.m_slash = BonusSlashDamagePerLevel.Value;
			shared.m_damagesPerLevel.m_fire = BonusFireDamagePerLevel.Value;
			shared.m_toolTier = ToolTier.Value;
			shared.m_damages.m_chop = ChopDamage.Value;
			shared.m_damagesPerLevel.m_chop = BonusChopDamagePerLevel.Value;
			shared.m_blockPower = BlockPower.Value;
			shared.m_blockPowerPerLevel = BlockPowerPerLevel.Value;
			shared.m_deflectionForce = DeflectionForce.Value;
			shared.m_deflectionForcePerLevel = DeflectionForcePerLevel.Value;
			return val3;
		}
	}
	public class SunArrowItem : Item
	{
		public static ConfigEntry<CraftingTable> CraftingStationRequired;

		public static ConfigEntry<int> CraftingStationLevel;

		public static ConfigEntry<string> CraftingCost;

		public static ConfigEntry<float> Knockback;

		public static ConfigEntry<float> PiercingDamage;

		public static ConfigEntry<float> FireDamage;

		public override string ItemName => "ChebGonaz_SunArrow";

		public override string PrefabName => "ChebGonaz_SunArrow.prefab";

		public override string NameLocalization => "$chebgonaz_sunarrow";

		public override string DescriptionLocalization => "$chebgonaz_sunarrow_desc";

		protected override string DefaultRecipe => "Flametal:2,FineWood:20";

		public override void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_011f: 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_012c: Expected O, but got Unknown
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			CraftingStationRequired = plugin.Config.Bind<CraftingTable>(((object)this).GetType().Name + " (Server Synced)", "CraftingStation", (CraftingTable)3, new ConfigDescription("Crafting station where it's available", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingStationLevel = plugin.Config.Bind<int>(((object)this).GetType().Name + " (Server Synced)", "CraftingStationLevel", 1, new ConfigDescription("Crafting station level required to craft", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			CraftingCost = plugin.Config.Bind<string>(((object)this).GetType().Name + " (Server Synced)", "CraftingCosts", ((Item)this).DefaultRecipe, new ConfigDescription("Materials needed to craft it. None or Blank will use Default settings.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Knockback = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "Knockback", 35f, new ConfigDescription("Bow's base knockback value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			PiercingDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "PiercingDamage", 95f, new ConfigDescription("Base piercing damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			FireDamage = plugin.Config.Bind<float>(((object)this).GetType().Name + " (Server Synced)", "FireDamage", 5f, new ConfigDescription("Base fire damage value.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
		}

		public override void UpdateRecipe()
		{
			((Item)this).UpdateRecipe(CraftingStationRequired, CraftingCost, CraftingStationLevel);
		}

		public override CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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
			ItemConfig val = new ItemConfig
			{
				Name = ((Item)this).NameLocalization,
				Description = ((Item)this).DescriptionLocalization,
				Amount = 20
			};
			if (string.IsNullOrEmpty(CraftingCost.Value))
			{
				CraftingCost.Value = ((Item)this).DefaultRecipe;
			}
			((Item)this).SetRecipeReqs(val, CraftingCost, CraftingStationRequired, CraftingStationLevel);
			CustomItem val2 = new CustomItem(prefab, false, val);
			if ((Object)(object)val2.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + ((Item)this).PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			SharedData shared = val2.ItemDrop.m_itemData.m_shared;
			shared.m_attackForce = Knockback.Value;
			shared.m_damages.m_pierce = PiercingDamage.Value;
			shared.m_damages.m_fire = FireDamage.Value;
			return val2;
		}
	}
}
namespace ChebsMythicalWeapons.Creatures
{
	public class MinotaurCreature : MonoBehaviour
	{
		public const string PrefabName = "ChebGonaz_Minotaur.prefab";

		public const string CreatureName = "ChebGonaz_Minotaur";

		public static ConfigEntry<Faction> Faction;

		public static ConfigEntry<float> SpawnChance;

		public static ConfigEntry<float> SpawnInterval;

		public static ConfigEntry<float> SpawnDistance;

		public static ConfigEntry<float> Health;

		public static ConfigEntry<int> MaxSpawned;

		public static ConfigEntry<Biome> Biome;

		public static ConfigEntry<PinType> MapMarker;

		private PinData _pinData;

		public static string LocalizedName => LocalizationManager.Instance.TryTranslate("$chebgonaz_minotaur");

		public static void CreateConfigs(BaseUnityPlugin plugin)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//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_00e9: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			Faction = plugin.Config.Bind<Faction>("MinotaurCreature (Server Synced)", "Faction", (Faction)7, new ConfigDescription("The faction of the character.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SpawnChance = plugin.Config.Bind<float>("MinotaurCreature (Server Synced)", "SpawnChance", 1f, new ConfigDescription("The chance of spawning the creature.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SpawnInterval = plugin.Config.Bind<float>("MinotaurCreature (Server Synced)", "SpawnInterval", 1f, new ConfigDescription("The interval between creature spawns.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SpawnDistance = plugin.Config.Bind<float>("MinotaurCreature (Server Synced)", "SpawnDistance", 1f, new ConfigDescription("The distance at which the creature can spawn.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			MaxSpawned = plugin.Config.Bind<int>("MinotaurCreature (Server Synced)", "MaxSpawned", 1, new ConfigDescription("The maximum number of creatures that can be spawned.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Biome = plugin.Config.Bind<Biome>("MinotaurCreature (Server Synced)", "Biome", (Biome)16, new ConfigDescription("The biome where the creature spawns.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			Health = plugin.Config.Bind<float>("MinotaurCreature (Server Synced)", "Health", 2500f, new ConfigDescription("The health of the creature.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			MapMarker = plugin.Config.Bind<PinType>("MinotaurCreature (Client)", "MapMarker", (PinType)9, new ConfigDescription("The type of map marker shown for the minotaur (set to None to disable).", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024:

plugins/ChebsValheimLibrary.dll

Decompiled 4 months 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using ChebsValheimLibrary.Common;
using ChebsValheimLibrary.Items;
using ChebsValheimLibrary.Items.Armor.BlackMetal;
using ChebsValheimLibrary.Items.Armor.Bronze;
using ChebsValheimLibrary.Items.Armor.Iron;
using ChebsValheimLibrary.Items.Armor.Leather;
using ChebsValheimLibrary.Items.Armor.Leather.Lox;
using ChebsValheimLibrary.Items.Armor.Leather.Troll;
using ChebsValheimLibrary.Items.Armor.Leather.Wolf;
using ChebsValheimLibrary.Items.Armor.Mage;
using ChebsValheimLibrary.Items.Tools;
using ChebsValheimLibrary.Items.Weapons.BlackMetal;
using ChebsValheimLibrary.Items.Weapons.Bows;
using ChebsValheimLibrary.Items.Weapons.Bronze;
using ChebsValheimLibrary.Items.Weapons.Iron;
using ChebsValheimLibrary.Items.Weapons.Mage;
using ChebsValheimLibrary.Items.Weapons.Needle;
using ChebsValheimLibrary.Items.Weapons.Poison;
using ChebsValheimLibrary.Items.Weapons.Wood;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using SimpleJson;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Cheb's Valheim Library")]
[assembly: AssemblyDescription("A library which contains shared classes and things required by all my mods.")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCompany("Cheb Gonaz")]
[assembly: AssemblyProduct("Cheb's Valheim Library")]
[assembly: AssemblyCopyright("Copyright © Joshua Paul Woods 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1E536FEC-8273-41BD-A291-89E47BF776B9")]
[assembly: AssemblyFileVersion("2.5.3.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.5.3.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ChebsValheimLibrary
{
	public class Base
	{
		public static readonly Version CurrentVersion = new Version("2.5.3");

		public static bool VersionCheck(Version version, out string message)
		{
			if (version.Major != CurrentVersion.Major)
			{
				message = "Major version difference detected! Please check your ChebsValheimLibrary.dll version! " + $"Mod expected {version}, but library version is {CurrentVersion}";
				return false;
			}
			if (version.Minor != CurrentVersion.Minor)
			{
				message = "Minor version difference detected! Please check your ChebsValheimLibrary.dll version! " + $"Mod expected {version}, but library version is {CurrentVersion}";
				return false;
			}
			if (version.Build < CurrentVersion.Build)
			{
				message = "Patch version difference detected. The mod expects an older ChebsValheimLibrary.dll version. This probably won't cause problems." + $"Mod expected {version}, but library version is {CurrentVersion}";
				return false;
			}
			message = "";
			return true;
		}

		public static GameObject LoadPrefabFromBundle(string prefabName, AssetBundle bundle, bool radeonFriendly)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			GameObject val = bundle.LoadAsset<GameObject>(prefabName);
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogFatal((object)("LoadPrefabFromBundle: " + prefabName + " is null!"));
			}
			if (radeonFriendly)
			{
				ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Object.Destroy((Object)(object)componentsInChildren[i]);
				}
				Humanoid val2 = default(Humanoid);
				if (val.TryGetComponent<Humanoid>(ref val2))
				{
					((Character)val2).m_deathEffects = new EffectList();
					val2.m_dropEffects = new EffectList();
					val2.m_equipEffects = new EffectList();
					val2.m_pickupEffects = new EffectList();
					val2.m_consumeItemEffects = new EffectList();
					((Character)val2).m_hitEffects = new EffectList();
					((Character)val2).m_jumpEffects = new EffectList();
					((Character)val2).m_slideEffects = new EffectList();
					val2.m_perfectBlockEffect = new EffectList();
					((Character)val2).m_tarEffects = new EffectList();
					((Character)val2).m_waterEffects = new EffectList();
					((Character)val2).m_flyingContinuousEffect = new EffectList();
				}
			}
			return val;
		}

		public static void LoadMinionItems(AssetBundle bundle, bool radeonFriendly)
		{
			List<Item> list = new List<Item>();
			list.Add(new SkeletonClub());
			list.Add(new SkeletonBow());
			list.Add(new SkeletonBow2());
			list.Add(new SkeletonBow3());
			list.Add(new SkeletonHelmetLeather());
			list.Add(new SkeletonHelmetBronze());
			list.Add(new SkeletonHelmetIron());
			list.Add(new SkeletonFireballLevel1());
			list.Add(new SkeletonFireballLevel2());
			list.Add(new SkeletonFireballLevel3());
			list.Add(new SkeletonMageCirclet());
			list.Add(new SkeletonAxe());
			list.Add(new BlackIronChest());
			list.Add(new BlackIronHelmet());
			list.Add(new BlackIronLegs());
			list.Add(new SkeletonHelmetBlackIron());
			list.Add(new SkeletonMace());
			list.Add(new SkeletonMace2());
			list.Add(new SkeletonMace3());
			list.Add(new SkeletonHelmetIronPoison());
			list.Add(new SkeletonHelmetBlackIronPoison());
			list.Add(new SkeletonHelmetLeatherPoison());
			list.Add(new SkeletonHelmetBronzePoison());
			list.Add(new SkeletonWoodAxe());
			list.Add(new SkeletonPickaxe());
			list.Add(new SkeletonAxeBlackMetal());
			list.Add(new SkeletonAxeBronze());
			list.Add(new SkeletonMaceBlackMetal());
			list.Add(new SkeletonMaceBronze());
			list.Add(new SkeletonMaceIron());
			list.Add(new SkeletonSwordBlackMetal());
			list.Add(new SkeletonSwordBronze());
			list.Add(new SkeletonSwordIron());
			list.Add(new SkeletonBowFire());
			list.Add(new SkeletonBowPoison());
			list.Add(new SkeletonBowFrost());
			list.Add(new SkeletonBowSilver());
			list.Add(new SkeletonMaceNeedle());
			list.Add(new HelmetLeatherTroll());
			list.Add(new HelmetLeatherWolf());
			list.Add(new HelmetLeatherLox());
			list.Add(new SkeletonHelmetLeatherTroll());
			list.Add(new SkeletonHelmetLeatherPoisonTroll());
			list.Add(new SkeletonArmorLeatherChestTroll());
			list.Add(new SkeletonArmorLeatherLegsTroll());
			list.Add(new SkeletonHelmetLeatherWolf());
			list.Add(new SkeletonHelmetLeatherPoisonWolf());
			list.Add(new SkeletonArmorLeatherChestWolf());
			list.Add(new SkeletonArmorLeatherLegsWolf());
			list.Add(new SkeletonHelmetLeatherLox());
			list.Add(new SkeletonHelmetLeatherPoisonLox());
			list.Add(new SkeletonArmorLeatherChestLox());
			list.Add(new SkeletonArmorLeatherLegsLox());
			list.ForEach(delegate(Item minionItem)
			{
				if (ItemManager.Instance.GetItem(minionItem.ItemName) == null)
				{
					GameObject prefab = LoadPrefabFromBundle(minionItem.PrefabName, bundle, radeonFriendly);
					ItemManager.Instance.AddItem(minionItem.GetCustomItemFromPrefab(prefab));
				}
			});
		}
	}
}
namespace ChebsValheimLibrary.Structures
{
	public class Structure : MonoBehaviour
	{
		public const float PlayerDetectionDistance = 150f;

		public static ChebsRecipe ChebsRecipeConfig;

		public static void UpdateRecipe()
		{
		}

		protected bool EnemiesNearby(out Character characterInRange, float radius)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			List<Character> list = new List<Character>();
			Character.GetCharactersInRange(((Component)this).transform.position, radius, list);
			using (IEnumerator<Character> enumerator = list.Where((Character character) => (Object)(object)character != (Object)null && (int)character.m_faction != 0 && !character.m_tamed).GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					Character current = enumerator.Current;
					characterInRange = current;
					return true;
				}
			}
			characterInRange = null;
			return false;
		}
	}
}
namespace ChebsValheimLibrary.PvP
{
	public class PvPManager
	{
		public static bool HeavyLogging;

		private static CustomRPC _pvPrpc;

		private const string GetDictString = "CG_PvP_1";

		private const string UpdateDictString = "CG_PvP_2";

		private const string PvPrpcName = "PvPrpc";

		private static Dictionary<string, List<string>> _playerFriends;

		private static string AllyFileName => ZNet.instance.GetWorldName() + ".ChebsValheimLibrary.PvP.json";

		private static Dictionary<string, List<string>> PlayerFriends
		{
			get
			{
				if ((ZNetExtension.IsServerInstance(ZNet.instance) || ZNetExtension.IsLocalInstance(ZNet.instance)) && _playerFriends == null)
				{
					_playerFriends = new Dictionary<string, List<string>>();
					_playerFriends = ReadAllyFile();
				}
				return _playerFriends;
			}
			set
			{
				_playerFriends = value;
			}
		}

		public static void InitialFriendsListRequest()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			if (ZNetExtension.IsClientInstance(ZNet.instance) || ZNetExtension.IsLocalInstance(ZNet.instance))
			{
				ZPackage val = new ZPackage(Encoding.UTF8.GetBytes("CG_PvP_1 " + Player.m_localPlayer.GetPlayerID()));
				_pvPrpc.SendPackage(ZRoutedRpc.instance.GetServerPeerID(), val);
			}
		}

		public static List<string> GetPlayerFriends()
		{
			if (PlayerFriends == null || !PlayerFriends.TryGetValue(Player.m_localPlayer.GetPlayerName(), out var value))
			{
				return new List<string>();
			}
			return value;
		}

		public static bool Friendly(string minionMasterA, string minionMasterB)
		{
			if (PlayerFriends != null && PlayerFriends.TryGetValue(minionMasterA, out var value))
			{
				return value.Contains(minionMasterB);
			}
			return false;
		}

		public static void ConfigureRPC()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0027: Expected O, but got Unknown
			_pvPrpc = NetworkManager.Instance.AddRPC("PvPrpc", new CoroutineHandler(PvP_RPCServerReceive), new CoroutineHandler(PvP_RPCClientReceive));
		}

		private static void UpdateAllyFile(string content)
		{
			string text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AllyFileName);
			if (!File.Exists(text))
			{
				try
				{
					using FileStream fileStream = File.Create(text);
					fileStream.Close();
				}
				catch (Exception ex)
				{
					Logger.LogError((object)("Error creating " + text + ": " + ex.Message));
				}
			}
			try
			{
				using StreamWriter streamWriter = new StreamWriter(text, append: false);
				streamWriter.Write(content);
				streamWriter.Close();
			}
			catch (Exception ex2)
			{
				Logger.LogError((object)("Error writing to " + text + ": " + ex2.Message));
			}
		}

		private static Dictionary<string, List<string>> ReadAllyFile()
		{
			string text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AllyFileName);
			if (!File.Exists(text))
			{
				try
				{
					using FileStream fileStream = File.Create(text);
					fileStream.Close();
				}
				catch (Exception ex)
				{
					Logger.LogError((object)("Error creating " + text + ": " + ex.Message));
				}
			}
			string text2 = null;
			try
			{
				using StreamReader streamReader = new StreamReader(text);
				text2 = streamReader.ReadToEnd();
				streamReader.Close();
			}
			catch (Exception ex2)
			{
				Logger.LogError((object)("Error reading from " + text + ": " + ex2.Message));
			}
			if (text2 == null)
			{
				Logger.LogError((object)("Error reading " + text + ": content is null!"));
				return new Dictionary<string, List<string>>();
			}
			if (!(text2 == ""))
			{
				return SimpleJson.DeserializeObject<Dictionary<string, List<string>>>(text2);
			}
			return new Dictionary<string, List<string>>();
		}

		public static void UpdatePlayerFriendsDict(List<string> list, Player player = null)
		{
			UpdatePlayerFriendsDict(string.Join(",", list.Select((string s) => s.Trim())), player);
		}

		private static void UpdatePlayerFriendsDict(string list, Player player = null)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			if ((Object)(object)player == (Object)null)
			{
				player = Player.m_localPlayer;
			}
			if ((Object)(object)player == (Object)null)
			{
				Logger.LogWarning((object)"UpdatePlayerFriendsDict m_localPlayer is null");
				return;
			}
			string s = "CG_PvP_2;" + player.GetPlayerName() + ";" + list;
			ZPackage val = new ZPackage(Encoding.UTF8.GetBytes(s));
			_pvPrpc.SendPackage(ZRoutedRpc.instance.GetServerPeerID(), val);
		}

		private static IEnumerator PvP_RPCServerReceive(long sender, ZPackage package)
		{
			if ((Object)(object)ZNet.instance == (Object)null)
			{
				yield return null;
			}
			if (ZNetExtension.IsServerInstance(ZNet.instance) || ZNetExtension.IsLocalInstance(ZNet.instance))
			{
				byte[] array = package.GetArray();
				string @string = Encoding.UTF8.GetString(array);
				if (@string.StartsWith("CG_PvP_1"))
				{
					if (HeavyLogging)
					{
						Logger.LogInfo((object)"PvP_RPCServerReceive CG_PvP_1");
					}
					string text = SimpleJson.SerializeObject((object)((IEnumerable<KeyValuePair<string, List<string>>>)PlayerFriends).ToDictionary((Func<KeyValuePair<string, List<string>>, string>)((KeyValuePair<string, List<string>> kvp) => kvp.Key), (Func<KeyValuePair<string, List<string>>, object>)((KeyValuePair<string, List<string>> kvp) => kvp.Value)));
					_pvPrpc.SendPackage(sender, new ZPackage(Encoding.UTF8.GetBytes("CG_PvP_1;" + text)));
				}
				else if (@string.StartsWith("CG_PvP_2"))
				{
					if (HeavyLogging)
					{
						Logger.LogInfo((object)"PvP_RPCServerReceive CG_PvP_2");
					}
					string[] array2 = @string.Split(new char[1] { ';' });
					if (array2.Length != 3)
					{
						Logger.LogError((object)$"Failed to parse payload ({array2.Length})");
					}
					string key = array2[1];
					string[] source = array2[2].Split(new char[1] { ',' });
					PlayerFriends[key] = source.ToList();
					string text2 = SimpleJson.SerializeObject((object)((IEnumerable<KeyValuePair<string, List<string>>>)PlayerFriends).ToDictionary((Func<KeyValuePair<string, List<string>>, string>)((KeyValuePair<string, List<string>> kvp) => kvp.Key), (Func<KeyValuePair<string, List<string>>, object>)((KeyValuePair<string, List<string>> kvp) => kvp.Value)));
					string text3 = "CG_PvP_1;" + text2;
					if (HeavyLogging)
					{
						Logger.LogMessage((object)("PvP_RPCServerReceive CG_PvP_2 sending to all peers: " + text3));
					}
					_pvPrpc.SendPackage(ZNet.instance.m_peers, new ZPackage(Encoding.UTF8.GetBytes(text3)));
					UpdateAllyFile(text2);
				}
			}
			yield return null;
		}

		private static IEnumerator PvP_RPCClientReceive(long sender, ZPackage package)
		{
			byte[] array = package.GetArray();
			if (array.Length != 0)
			{
				string @string = Encoding.UTF8.GetString(array);
				if (@string.StartsWith("CG_PvP_1"))
				{
					if (HeavyLogging)
					{
						Logger.LogInfo((object)("PvP_RPCClientReceive decoded: " + @string));
					}
					string[] array2 = @string.Split(new char[1] { ';' });
					if (array2.Length != 2)
					{
						Logger.LogError((object)$"Failed to parse payload ({array2.Length})");
					}
					PlayerFriends = SimpleJson.DeserializeObject<Dictionary<string, List<string>>>(array2[1]);
				}
			}
			else if (HeavyLogging)
			{
				Logger.LogInfo((object)"PvP_RPCClientReceive received no data");
			}
			yield return null;
		}
	}
}
namespace ChebsValheimLibrary.Minions
{
	public class FreshMinion : MonoBehaviour
	{
	}
	public class ChebGonazMinion : MonoBehaviour
	{
		public enum CleanupType
		{
			None,
			Time,
			Logout
		}

		public enum DropType
		{
			Nothing,
			JustResources,
			Everything
		}

		public enum State
		{
			Waiting,
			Roaming,
			Following
		}

		public enum ArmorType
		{
			None,
			Leather,
			LeatherTroll,
			LeatherWolf,
			LeatherLox,
			Bronze,
			Iron,
			BlackMetal
		}

		public bool canBeCommanded = true;

		public const string MinionOwnershipZdoKey = "UndeadMinionMaster";

		public const string MinionDropsZdoKey = "UndeadMinionDrops";

		public const string MinionWaitPosZdoKey = "UndeadMinionWaitPosition";

		public const string MinionWaitObjectName = "UndeadMinionWaitPositionObject";

		public int createdOrder;

		private static readonly int VehicleLayer = LayerMask.NameToLayer("vehicle");

		private static List<Transform> _deathCrates = new List<Transform>();

		public bool ItemsDropped { get; private set; }

		private Vector3 StatusRoaming => Vector3.negativeInfinity;

		private Vector3 StatusFollowing => Vector3.positiveInfinity;

		public string UndeadMinionMaster
		{
			get
			{
				ZNetView val = default(ZNetView);
				if (!((Component)this).TryGetComponent<ZNetView>(ref val))
				{
					return "";
				}
				return val.GetZDO().GetString("UndeadMinionMaster", "");
			}
			set
			{
				ZNetView val = default(ZNetView);
				if (((Component)this).TryGetComponent<ZNetView>(ref val))
				{
					val.GetZDO().Set("UndeadMinionMaster", value);
				}
				else
				{
					Logger.LogError((object)("Cannot SetUndeadMinionMaster to " + value + " because it has no ZNetView component."));
				}
			}
		}

		public State Status
		{
			get
			{
				//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_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Vector3 waitPosition = GetWaitPosition();
				if (((Vector3)(ref waitPosition)).Equals(StatusFollowing))
				{
					return State.Following;
				}
				if (!((Vector3)(ref waitPosition)).Equals(StatusRoaming))
				{
					return State.Waiting;
				}
				return State.Roaming;
			}
		}

		public bool DepositIntoNearbyDeathCrate(CharacterDrop characterDrop, float range = 15f)
		{
			_deathCrates.RemoveAll((Transform t) => (Object)(object)t == (Object)null);
			Container val = default(Container);
			foreach (Transform item in _deathCrates.OrderBy((Transform t) => Vector3.Distance(t.position, ((Component)this).transform.position) < range))
			{
				if (characterDrop.m_drops.Count < 1)
				{
					break;
				}
				if (!((Component)item).TryGetComponent<Container>(ref val))
				{
					continue;
				}
				Inventory inventory = val.GetInventory();
				if (inventory == null)
				{
					continue;
				}
				List<Drop> list = new List<Drop>();
				foreach (Drop drop in characterDrop.m_drops)
				{
					if (inventory.CanAddItem(drop.m_prefab, -1))
					{
						inventory.AddItem(drop.m_prefab, drop.m_amountMax);
					}
					else
					{
						list.Add(drop);
					}
				}
				characterDrop.m_drops = list;
			}
			if (characterDrop.m_drops.Count < 1)
			{
				ItemsDropped = true;
				return ItemsDropped;
			}
			Container val2 = CreateDeathCrate();
			if ((Object)(object)val2 != (Object)null)
			{
				Inventory inv = val2.GetInventory();
				List<Drop> unsuccessful = new List<Drop>();
				characterDrop.m_drops.ForEach(delegate(Drop drop)
				{
					if (!inv.AddItem(drop.m_prefab, drop.m_amountMax))
					{
						unsuccessful.Add(drop);
					}
				});
				characterDrop.m_drops = unsuccessful;
				ItemsDropped = unsuccessful.Count == 0;
			}
			return ItemsDropped;
		}

		private Container CreateDeathCrate()
		{
			//IL_0015: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("CargoCrate"), ((Component)this).transform.position + Vector3.up, Quaternion.identity);
			_deathCrates.Add(val.transform);
			return val.GetComponent<Container>();
		}

		public static ArmorType DetermineArmorType(Inventory inventory, int armorBlackIronRequired, int armorIronRequired, int armorBronzeRequired, int armorLeatherRequired)
		{
			if (inventory.CountItems("$item_blackmetal", -1, true) >= armorBlackIronRequired)
			{
				return ArmorType.BlackMetal;
			}
			if (inventory.CountItems("$item_iron", -1, true) >= armorIronRequired)
			{
				return ArmorType.Iron;
			}
			if (inventory.CountItems("$item_bronze", -1, true) >= armorBronzeRequired)
			{
				return ArmorType.Bronze;
			}
			if (inventory.CountItems("$item_trollhide", -1, true) >= armorLeatherRequired)
			{
				return ArmorType.LeatherTroll;
			}
			if (inventory.CountItems("$item_wolfpelt", -1, true) >= armorLeatherRequired)
			{
				return ArmorType.LeatherWolf;
			}
			if (inventory.CountItems("$item_loxpelt", -1, true) >= armorLeatherRequired)
			{
				return ArmorType.LeatherLox;
			}
			foreach (string item in new List<string> { "$item_leatherscraps", "$item_deerhide", "$item_scalehide" })
			{
				if (inventory.CountItems(item, -1, true) >= armorLeatherRequired)
				{
					return ArmorType.Leather;
				}
			}
			return ArmorType.None;
		}

		public static bool CanSpawn(MemoryConfigEntry<string, List<string>> itemsCost, Inventory inventory, out string message)
		{
			return CanSpawn(itemsCost.Value, inventory, out message);
		}

		public static bool CanSpawn(string itemsCost, Inventory inventory, out string message)
		{
			return CanSpawn(itemsCost?.Split(new char[1] { ',' }).ToList(), inventory, out message);
		}

		public static bool CanSpawn(List<string> itemsCost, Inventory inventory, out string message)
		{
			message = "";
			List<Tuple<bool, string>> list = new List<Tuple<bool, string>>();
			foreach (string item2 in itemsCost)
			{
				string[] array = item2.Split(new char[1] { ':' });
				if (array.Length != 2)
				{
					message = "[1] Error in config for ItemsCost - please revise: (" + item2 + ")";
					Logger.LogError((object)message);
					return false;
				}
				string item = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					message = "[2] Error in config for ItemsCost - please revise: (" + item2 + ")";
					Logger.LogError((object)message);
					return false;
				}
				Tuple<int, string, List<string>> tuple = CountItems(item, inventory);
				bool flag = tuple.Item1 >= result;
				message = (flag ? "" : ("Not enough " + string.Join("/", tuple.Item3)));
				list.Add(new Tuple<bool, string>(flag, message));
			}
			Tuple<bool, string> tuple2 = list.Find((Tuple<bool, string> t) => !t.Item1);
			if (tuple2 != null)
			{
				message = tuple2.Item2;
				return false;
			}
			return true;
		}

		public static void ConsumeRequirements(MemoryConfigEntry<string, List<string>> itemsCost, Inventory inventory)
		{
			ConsumeRequirements(itemsCost.Value, inventory);
		}

		public static void ConsumeRequirements(string itemsCost, Inventory inventory)
		{
			ConsumeRequirements(itemsCost?.Split(new char[1] { ',' }).ToList(), inventory);
		}

		protected static void ConsumeRequirements(List<string> itemsCost, Inventory inventory)
		{
			foreach (string item in itemsCost)
			{
				string[] array = item.Split(new char[1] { ':' });
				if (array.Length != 2)
				{
					Logger.LogError((object)"Error in config for ItemsCost - please revise.");
					break;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					Logger.LogError((object)"Error in config for ItemsCost - please revise.");
					break;
				}
				int num = 0;
				string[] array2 = text.Split(new char[1] { '|' });
				foreach (string text2 in array2)
				{
					if (num >= result)
					{
						break;
					}
					GameObject prefab = ZNetScene.instance.GetPrefab(text2);
					if ((Object)(object)prefab == (Object)null)
					{
						Logger.LogError((object)("Error processing config for ItemsCost: " + text + " doesn't exist."));
						return;
					}
					string text3 = prefab.GetComponent<ItemDrop>()?.m_itemData.m_shared.m_name;
					int num2 = inventory.CountItems(text3, -1, true);
					for (int j = 0; j < num2; j++)
					{
						if (num >= result)
						{
							break;
						}
						inventory.RemoveItem(text3, 1, -1, true);
						num++;
					}
				}
			}
		}

		protected static void GenerateDeathDrops(CharacterDrop characterDrop, MemoryConfigEntry<string, List<string>> itemsCost)
		{
			List<string> value = itemsCost.Value;
			GenerateDeathDrops(characterDrop, value);
		}

		protected static void GenerateDeathDrops(CharacterDrop characterDrop, string itemsCost)
		{
			List<string> itemsCost2 = itemsCost?.Split(new char[1] { ',' }).ToList();
			GenerateDeathDrops(characterDrop, itemsCost2);
		}

		protected static void GenerateDeathDrops(CharacterDrop characterDrop, List<string> itemsCost)
		{
			//IL_00ad: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			foreach (string item in itemsCost)
			{
				string[] array = item.Split(new char[1] { ':' });
				if (array.Length != 2)
				{
					Logger.LogError((object)"Error in config for ItemsCost - please revise.");
					break;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					Logger.LogError((object)"Error in config for ItemsCost - please revise.");
					break;
				}
				string[] array2 = text.Split(new char[1] { '|' });
				int num = 0;
				if (num < array2.Length)
				{
					string text2 = array2[num];
					GameObject prefab = ZNetScene.instance.GetPrefab(text2);
					if ((Object)(object)prefab == (Object)null)
					{
						Logger.LogError((object)("Error processing config for ItemsCost: " + text2 + " doesn't exist."));
						break;
					}
					characterDrop.m_drops.Add(new Drop
					{
						m_prefab = prefab,
						m_onePerPlayer = false,
						m_amountMin = result,
						m_amountMax = result,
						m_chance = 1f
					});
				}
			}
		}

		private static Tuple<int, string, List<string>> CountItems(string item, Inventory inventory)
		{
			int num = 0;
			List<string> list = new List<string>();
			string[] array = item.Split(new char[1] { '|' });
			foreach (string text in array)
			{
				GameObject prefab = ZNetScene.instance.GetPrefab(text);
				if ((Object)(object)prefab == (Object)null)
				{
					string text2 = "Error processing config for ItemsCost: " + text + " doesn't exist.";
					Logger.LogError((object)text2);
					return new Tuple<int, string, List<string>>(0, text2, list);
				}
				string text3 = prefab.GetComponent<ItemDrop>()?.m_itemData.m_shared.m_name;
				list.Add(text3);
				int num2 = inventory.CountItems(text3, -1, true);
				num += num2;
			}
			return new Tuple<int, string, List<string>>(num, "", list);
		}

		private void OnCollisionEnter(Collision collision)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Character component = collision.gameObject.GetComponent<Character>();
			if ((Object)(object)component != (Object)null && (int)component.m_faction == 0 && (Object)(object)((Component)component).GetComponent<ChebGonazMinion>() == (Object)null)
			{
				Physics.IgnoreCollision(collision.collider, ((Component)this).GetComponent<Collider>());
			}
			else if ((Object)(object)collision.gameObject.GetComponentInParent<Vagon>() != (Object)null)
			{
				Physics.IgnoreCollision(collision.collider, ((Component)this).GetComponent<Collider>());
			}
		}

		public void Kill()
		{
			Character val = default(Character);
			if (((Component)this).TryGetComponent<Character>(ref val))
			{
				if (!val.IsDead())
				{
					val.SetHealth(0f);
				}
			}
			else
			{
				Logger.LogError((object)("Cannot kill " + ((Object)this).name + " because it has no Character component."));
			}
		}

		public bool BelongsToPlayer(string playerName)
		{
			ZNetView val = default(ZNetView);
			if (((Component)this).TryGetComponent<ZNetView>(ref val))
			{
				return val.GetZDO().GetString("UndeadMinionMaster", "").ToLower()
					.Trim()
					.Equals(playerName.ToLower().Trim());
			}
			return false;
		}

		public void RecordDrops(CharacterDrop characterDrop)
		{
			ZNetView val = default(ZNetView);
			if (((Component)this).TryGetComponent<ZNetView>(ref val))
			{
				string text = "";
				List<string> drops = new List<string>();
				characterDrop.m_drops.ForEach(delegate(Drop drop)
				{
					drops.Add($"{((Object)drop.m_prefab).name}:{drop.m_amountMax}");
				});
				text = string.Join(",", drops);
				val.GetZDO().Set("UndeadMinionDrops", string.Join(",", text));
			}
			else
			{
				Logger.LogError((object)("Cannot record drops because " + ((Object)this).name + " has no ZNetView component."));
			}
		}

		public void RestoreDrops()
		{
			ZNetView val = default(ZNetView);
			if (((Component)this).TryGetComponent<ZNetView>(ref val))
			{
				CharacterDrop characterDrop = ((Component)this).gameObject.GetComponent<CharacterDrop>();
				if ((Object)(object)characterDrop == (Object)null)
				{
					characterDrop = ((Component)this).gameObject.AddComponent<CharacterDrop>();
				}
				string @string = val.GetZDO().GetString("UndeadMinionDrops", "");
				if (!(@string == ""))
				{
					new List<string>(@string.Split(new char[1] { ',' })).ForEach(delegate(string dropString)
					{
						string[] array = dropString.Split(new char[1] { ':' });
						string prefabName = array[0];
						int amount = int.Parse(array[1]);
						AddOrUpdateDrop(characterDrop, prefabName, amount);
					});
				}
			}
			else
			{
				Logger.LogError((object)("Cannot record drops because " + ((Object)this).name + " has no ZNetView component."));
			}
		}

		protected void RecordWaitPosition(Vector3 waitPos)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			ZNetView val = default(ZNetView);
			if (((Component)this).TryGetComponent<ZNetView>(ref val))
			{
				if (!val.IsOwner())
				{
					val.ClaimOwnership();
				}
				val.GetZDO().Set("UndeadMinionWaitPosition", waitPos);
			}
			else
			{
				Logger.LogError((object)$"Cannot RecordWaitPosition {waitPos} because it has no ZNetView component.");
			}
		}

		protected Vector3 GetWaitPosition()
		{
			//IL_002c: 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)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			ZNetView val = default(ZNetView);
			if (((Component)this).TryGetComponent<ZNetView>(ref val))
			{
				return val.GetZDO().GetVec3("UndeadMinionWaitPosition", StatusRoaming);
			}
			Logger.LogError((object)"Cannot GetWaitPosition because it has no ZNetView component.");
			return StatusRoaming;
		}

		public void RoamFollowOrWait()
		{
			//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_000a: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Vector3 waitPosition = GetWaitPosition();
			MonsterAI val2 = default(MonsterAI);
			if (((Vector3)(ref waitPosition)).Equals(StatusFollowing))
			{
				Player val = Player.GetAllPlayers().Find((Player p) => BelongsToPlayer(p.GetPlayerName()));
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogError((object)(((Object)this).name + " should be following but has no associated player. Roaming instead."));
					Roam();
				}
				else
				{
					Follow(((Component)val).gameObject);
				}
			}
			else if (((Vector3)(ref waitPosition)).Equals(StatusRoaming))
			{
				Roam();
			}
			else if (!((Component)this).TryGetComponent<MonsterAI>(ref val2))
			{
				Logger.LogError((object)(((Object)this).name + " cannot WaitAtRecordedPosition because it has no MonsterAI component."));
			}
			else
			{
				GameObject val3 = new GameObject("UndeadMinionWaitPositionObject");
				val3.transform.position = waitPosition;
				val2.SetFollowTarget(val3);
			}
		}

		public void Follow(GameObject followObject)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			MonsterAI val = default(MonsterAI);
			if (!((Component)this).TryGetComponent<MonsterAI>(ref val))
			{
				Logger.LogError((object)"Cannot Follow because it has no MonsterAI component.");
				return;
			}
			GameObject followTarget = val.GetFollowTarget();
			if ((Object)(object)followTarget != (Object)null && ((Object)followTarget).name == "UndeadMinionWaitPositionObject")
			{
				Object.Destroy((Object)(object)followTarget);
			}
			RecordWaitPosition(StatusFollowing);
			val.SetFollowTarget(followObject);
		}

		public void Wait(Vector3 waitPosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			RecordWaitPosition(waitPosition);
			RoamFollowOrWait();
		}

		public void Roam()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			RecordWaitPosition(StatusRoaming);
			MonsterAI val = default(MonsterAI);
			if (!((Component)this).TryGetComponent<MonsterAI>(ref val))
			{
				Logger.LogError((object)("Cannot Roam because " + ((Object)this).name + " has no MonsterAI component!"));
				return;
			}
			GameObject followTarget = val.GetFollowTarget();
			if ((Object)(object)followTarget != (Object)null && ((Object)followTarget).name == "UndeadMinionWaitPositionObject")
			{
				Object.Destroy((Object)(object)followTarget);
			}
			val.SetFollowTarget((GameObject)null);
		}

		public static T FindClosest<T>(Transform targetTransform, float radius, int mask, Func<T, bool> where, bool interactable) where T : Component
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			ZNetView val = default(ZNetView);
			return (from t in (from c in Physics.OverlapSphere(targetTransform.position, radius, mask)
					where (Object)(object)((Component)c).GetComponentInParent<T>() != (Object)null
					select ((Component)c).GetComponentInParent<T>() into c
					where !interactable || (((Component)c).TryGetComponent<ZNetView>(ref val) && val.IsValid())
					select c).Where(@where)
				orderby Vector3.Distance(((Component)t).transform.position, targetTransform.position)
				select t).FirstOrDefault();
		}

		public static List<T> FindNearby<T>(Transform targetTransform, float radius, int mask, Func<T, bool> where, bool interactable) where T : Component
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			ZNetView val = default(ZNetView);
			return (from c in Physics.OverlapSphere(targetTransform.position, radius, mask)
				where (Object)(object)((Component)c).GetComponentInParent<T>() != (Object)null
				select ((Component)c).GetComponentInParent<T>() into c
				where !interactable || (((Component)c).TryGetComponent<ZNetView>(ref val) && val.IsValid())
				select c).Where(where).ToList();
		}

		public static void AddOrUpdateDrop(CharacterDrop characterDrop, string prefabName, int amount)
		{
			//IL_0048: 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_0063: 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: 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_0088: Expected O, but got Unknown
			Drop val = ((IEnumerable<Drop>)characterDrop.m_drops).FirstOrDefault((Func<Drop, bool>)((Drop drop) => ((Object)drop.m_prefab).name.Equals(prefabName)));
			if (val != null)
			{
				val.m_amountMin = amount;
				val.m_amountMax = amount;
				val.m_chance = 1f;
				return;
			}
			characterDrop.m_drops.Add(new Drop
			{
				m_prefab = ZNetScene.instance.GetPrefab(prefabName),
				m_onePerPlayer = true,
				m_amountMin = amount,
				m_amountMax = amount,
				m_chance = 1f
			});
		}

		public virtual void Awake()
		{
		}
	}
	public class NukeRock : NukeTree
	{
		protected override void Nuke()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_0125: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			Destructible componentInParent = ((Component)this).GetComponentInParent<Destructible>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				HitData val = new HitData();
				val.m_damage.m_pickaxe = 500f;
				val.m_toolTier = 100;
				componentInParent.Damage(val);
				return;
			}
			MineRock5 componentInParent2 = ((Component)this).GetComponentInParent<MineRock5>();
			Bounds bounds;
			if ((Object)(object)componentInParent2 != (Object)null)
			{
				for (int i = 0; i < componentInParent2.m_hitAreas.Count; i++)
				{
					HitArea val2 = componentInParent2.m_hitAreas[i];
					if (val2.m_health > 0f)
					{
						HitData val3 = new HitData();
						val3.m_damage.m_damage = val2.m_health;
						bounds = val2.m_collider.bounds;
						val3.m_point = ((Bounds)(ref bounds)).center;
						val3.m_toolTier = 100;
						componentInParent2.DamageArea(i, val3);
					}
				}
				return;
			}
			MineRock componentInParent3 = ((Component)this).GetComponentInParent<MineRock>();
			if (!((Object)(object)componentInParent3 != (Object)null))
			{
				return;
			}
			HitArea val5 = default(HitArea);
			for (int j = 0; j < componentInParent3.m_hitAreas.Length; j++)
			{
				Collider val4 = componentInParent3.m_hitAreas[j];
				if (((Component)val4).TryGetComponent<HitArea>(ref val5) && val5.m_health > 0f)
				{
					HitData val6 = new HitData();
					val6.m_damage.m_damage = val5.m_health;
					bounds = val4.bounds;
					val6.m_point = ((Bounds)(ref bounds)).center;
					val6.m_toolTier = 100;
					componentInParent2.DamageArea(j, val6);
				}
			}
		}
	}
	public class NukeTree : MonoBehaviour
	{
		public const float NukeAfter = 120f;

		private IEnumerator Start()
		{
			yield return (object)new WaitForSeconds(120f);
			Nuke();
			Object.Destroy((Object)(object)this);
		}

		protected virtual void Nuke()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			HitData val = new HitData();
			val.m_damage.m_chop = 999f;
			val.m_toolTier = 4;
			Destructible componentInParent = ((Component)this).GetComponentInParent<Destructible>();
			if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.GetDestructibleType() == 2)
			{
				componentInParent.Damage(val);
				return;
			}
			TreeLog componentInParent2 = ((Component)this).GetComponentInParent<TreeLog>();
			if ((Object)(object)componentInParent2 != (Object)null)
			{
				componentInParent2.Damage(val);
				return;
			}
			TreeBase componentInParent3 = ((Component)this).GetComponentInParent<TreeBase>();
			if ((Object)(object)componentInParent3 != (Object)null)
			{
				componentInParent3.Damage(val);
			}
		}
	}
}
namespace ChebsValheimLibrary.Minions.AI
{
	public class MinerAI : MonoBehaviour
	{
		private float _nextCheck;

		private float _lastChat;

		private MonsterAI _monsterAI;

		private Humanoid _humanoid;

		private List<string> _rocksList;

		private string _status;

		private bool _inContact;

		public virtual string RockInternalIDsList => "";

		public virtual float RoamRange => 0f;

		public virtual float LookRadius => 0f;

		public virtual float UpdateDelay => 0f;

		public virtual float ToolDamage => 6f;

		public virtual short ToolTier => 2;

		public virtual float ChatInterval => 5f;

		public virtual float ChatDistance => 5f;

		public string Status
		{
			get
			{
				return _status;
			}
			protected set
			{
				_status = value;
			}
		}

		public void LookForMineableObjects()
		{
			if ((Object)(object)_monsterAI.GetFollowTarget() != (Object)null)
			{
				return;
			}
			int mask = (1 << LayerMask.NameToLayer("static_solid")) | (1 << LayerMask.NameToLayer("Default_small"));
			Transform val = (from c in ChebGonazMinion.FindNearby<Transform>(((Component)this).transform, LookRadius, mask, (Func<Transform, bool>)Hittable, interactable: false)
				select (c, (((Object)c).name.Contains("_Tin") || ((Object)c).name.Contains("silver") || ((Object)c).name.Contains("copper")) ? 1 : 2) into t
				orderby t.Item2, Vector3.Distance(((Component)this).transform.position, t.c.position)
				select t).FirstOrDefault().ToTuple()?.Item1;
			if ((Object)(object)val != (Object)null)
			{
				_monsterAI.SetFollowTarget(((Component)val).gameObject);
				NukeRock nukeRock = default(NukeRock);
				if (!((Component)val).TryGetComponent<NukeRock>(ref nukeRock))
				{
					((Component)val).gameObject.AddComponent<NukeRock>();
				}
			}
		}

		public void UpdateToolProperties()
		{
			GameObject[] randomWeapon = _humanoid.m_randomWeapon;
			object obj;
			if (randomWeapon == null)
			{
				obj = null;
			}
			else
			{
				GameObject? obj2 = randomWeapon.FirstOrDefault();
				obj = ((obj2 != null) ? obj2.GetComponent<ItemDrop>() : null);
			}
			ItemDrop val = (ItemDrop)obj;
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Failed to update tool properties: tool is null");
				return;
			}
			val.m_itemData.m_shared.m_damages.m_pickaxe = ToolDamage;
			val.m_itemData.m_shared.m_toolTier = ToolTier;
		}

		protected virtual void Awake()
		{
			_rocksList = RockInternalIDsList.Split(new char[1] { ',' }).ToList();
			_monsterAI = ((Component)this).GetComponent<MonsterAI>();
			_humanoid = ((Component)this).GetComponent<Humanoid>();
			_monsterAI.m_alertRange = 1f;
			((BaseAI)_monsterAI).m_randomMoveRange = RoamRange;
			UpdateToolProperties();
		}

		protected virtual void FixedUpdate()
		{
			//IL_00fa: 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_0102: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			GameObject followTarget = _monsterAI.GetFollowTarget();
			if ((Object)(object)followTarget != (Object)null)
			{
				Player val = default(Player);
				if (followTarget.TryGetComponent<Player>(ref val))
				{
					string text = LocalizationManager.Instance.TryTranslate("$chebgonaz_minionstatus_following");
					_status = text + " " + val.GetPlayerName();
					return;
				}
				if (ChatInterval != 0f && Time.time > _lastChat + ChatInterval)
				{
					_lastChat = Time.time;
					List<Player> list = new List<Player>();
					Player.GetPlayersInRange(((Component)this).transform.position, ChatDistance, list);
					if (list.Count > 0)
					{
						string text2 = LocalizationManager.Instance.TryTranslate("$chebgonaz_worker_target");
						Chat.instance.SetNpcText(((Component)this).gameObject, Vector3.up, 5f, 10f, "", text2 + ": " + ((Object)followTarget.gameObject).name, false);
					}
				}
				Vector3 position = followTarget.transform.position;
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(position.x, ((Component)this).transform.position.y, position.z);
				((Component)this).transform.LookAt(val2);
				TryAttack();
			}
			if (Time.time > _nextCheck)
			{
				_nextCheck = Time.time + UpdateDelay + Random.value;
				LookForMineableObjects();
				_status = (((Object)(object)_monsterAI.GetFollowTarget() != (Object)null) ? (LocalizationManager.Instance.TryTranslate("$chebgonaz_worker_target") + ": (" + ((Object)_monsterAI.GetFollowTarget()).name + ").") : LocalizationManager.Instance.TryTranslate("$chebgonaz_worker_cantfindtarget"));
				((Character)_humanoid).m_name = _status;
			}
		}

		private void TryAttack()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00ea: 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_00f3: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			GameObject followTarget = _monsterAI.GetFollowTarget();
			if (!((Object)(object)followTarget != (Object)null) || !_inContact || !_monsterAI.DoAttack((Character)null, false))
			{
				return;
			}
			Destructible componentInParent = followTarget.GetComponentInParent<Destructible>();
			if ((Object)(object)componentInParent != (Object)null && componentInParent.m_minToolTier <= ToolTier)
			{
				HitData val = new HitData();
				val.m_damage.m_pickaxe = ToolDamage;
				val.m_toolTier = ToolTier;
				componentInParent.Damage(val);
				return;
			}
			MineRock5 componentInParent2 = followTarget.GetComponentInParent<MineRock5>();
			Bounds bounds;
			if ((Object)(object)componentInParent2 != (Object)null && componentInParent2.m_minToolTier <= ToolTier)
			{
				for (int i = 0; i < componentInParent2.m_hitAreas.Count; i++)
				{
					HitArea val2 = componentInParent2.m_hitAreas[i];
					if (val2.m_health > 0f)
					{
						HitData val3 = new HitData();
						val3.m_damage.m_damage = ToolDamage;
						bounds = val2.m_collider.bounds;
						val3.m_point = ((Bounds)(ref bounds)).center;
						val3.m_toolTier = ToolTier;
						componentInParent2.DamageArea(i, val3);
					}
				}
				return;
			}
			MineRock componentInParent3 = followTarget.GetComponentInParent<MineRock>();
			if (!((Object)(object)componentInParent3 != (Object)null) || componentInParent3.m_minToolTier > ToolTier)
			{
				return;
			}
			HitArea val5 = default(HitArea);
			for (int j = 0; j < componentInParent3.m_hitAreas.Length; j++)
			{
				Collider val4 = componentInParent3.m_hitAreas[j];
				if (((Component)val4).TryGetComponent<HitArea>(ref val5) && val5.m_health > 0f)
				{
					HitData val6 = new HitData();
					val6.m_damage.m_damage = ToolDamage;
					bounds = val4.bounds;
					val6.m_point = ((Bounds)(ref bounds)).center;
					val6.m_toolTier = ToolTier;
					componentInParent2.DamageArea(j, val6);
				}
			}
		}

		private void OnCollisionEnter(Collision collision)
		{
			_inContact = Hittable((collision != null) ? collision.gameObject : null);
		}

		private void OnCollisionExit(Collision other)
		{
			_inContact = Hittable((other != null) ? other.gameObject : null);
		}

		private bool Hittable(Transform t)
		{
			return Hittable(((Component)t).gameObject);
		}

		private bool Hittable(GameObject go)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			if ((Object)(object)go == (Object)null)
			{
				return false;
			}
			Destructible componentInParent = go.GetComponentInParent<Destructible>();
			if (_rocksList.FirstOrDefault(delegate(string rocksListName)
			{
				Transform parent = go.transform.parent;
				return (Object)(object)parent != (Object)null && rocksListName.Contains(((Object)parent).name);
			}) == null && (!((Object)(object)componentInParent != (Object)null) || (int)componentInParent.m_destructibleType != 1 || !((Object)(object)((Component)componentInParent).GetComponent<Container>() == (Object)null) || !((Object)(object)((Component)componentInParent).GetComponent<Pickable>() == (Object)null)) && !((Object)(object)go.GetComponentInParent<MineRock5>() != (Object)null))
			{
				return (Object)(object)go.GetComponentInParent<MineRock>() != (Object)null;
			}
			return true;
		}
	}
	public class WoodcutterAI : MonoBehaviour
	{
		private float _nextCheck;

		private float _lastChat;

		private MonsterAI _monsterAI;

		private Humanoid _humanoid;

		private readonly int _defaultMask = LayerMask.GetMask(new string[1] { "Default" });

		private static List<Transform> _transforms = new List<Transform>();

		private string _status;

		private bool _inContact;

		private bool _chopping;

		public virtual float RoamRange => 0f;

		public virtual float LookRadius => 0f;

		public virtual float UpdateDelay => 0f;

		public virtual float ToolDamage => 6f;

		public virtual short ToolTier => 2;

		public virtual float ChatInterval => 5f;

		public virtual float ChatDistance => 5f;

		public string Status
		{
			get
			{
				return _status;
			}
			protected set
			{
				_status = value;
			}
		}

		public void LookForCuttableObjects()
		{
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Invalid comparison between Unknown and I4
			if ((Object)(object)_monsterAI.GetFollowTarget() != (Object)null)
			{
				return;
			}
			_transforms.RemoveAll((Transform a) => (Object)(object)a == (Object)null);
			Transform val = ChebGonazMinion.FindClosest<Transform>(((Component)this).transform, LookRadius, _defaultMask, (Func<Transform, bool>)((Transform a) => !_transforms.Contains(a)), interactable: false);
			if ((Object)(object)val == (Object)null)
			{
				val = (from t in _transforms.Where(delegate(Transform t)
					{
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0017: Invalid comparison between Unknown and I4
						Destructible componentInParent4 = ((Component)t).GetComponentInParent<Destructible>();
						if ((Object)(object)componentInParent4 != (Object)null && (int)componentInParent4.GetDestructibleType() == 2 && componentInParent4.m_minToolTier <= ToolTier)
						{
							return true;
						}
						TreeLog componentInParent5 = ((Component)t).GetComponentInParent<TreeLog>();
						if ((Object)(object)componentInParent5 != (Object)null && componentInParent5.m_minToolTier <= ToolTier)
						{
							return true;
						}
						TreeBase componentInParent6 = ((Component)t).GetComponentInParent<TreeBase>();
						return ((Object)(object)componentInParent6 != (Object)null && componentInParent6.m_minToolTier <= ToolTier) ? true : false;
					})
					orderby Vector3.Distance(t.position, ((Component)this).transform.position)
					select t).FirstOrDefault();
			}
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			Destructible componentInParent = ((Component)val).GetComponentInParent<Destructible>();
			NukeTree nukeTree = default(NukeTree);
			if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.GetDestructibleType() == 2)
			{
				_transforms.Add(val);
				_monsterAI.SetFollowTarget(((Component)componentInParent).gameObject);
				_status = "Moving to stump.";
				if (!((Component)val).TryGetComponent<NukeTree>(ref nukeTree))
				{
					((Component)val).gameObject.AddComponent<NukeTree>();
				}
				return;
			}
			TreeLog componentInParent2 = ((Component)val).GetComponentInParent<TreeLog>();
			if ((Object)(object)componentInParent2 != (Object)null)
			{
				_transforms.Add(val);
				_monsterAI.SetFollowTarget(((Component)componentInParent2).gameObject);
				_status = "Moving to log.";
				if (!((Component)val).TryGetComponent<NukeTree>(ref nukeTree))
				{
					((Component)val).gameObject.AddComponent<NukeTree>();
				}
				return;
			}
			TreeBase componentInParent3 = ((Component)val).GetComponentInParent<TreeBase>();
			if ((Object)(object)componentInParent3 != (Object)null)
			{
				_transforms.Add(val);
				_monsterAI.SetFollowTarget(((Component)componentInParent3).gameObject);
				_status = "Moving to tree.";
				if (!((Component)val).TryGetComponent<NukeTree>(ref nukeTree))
				{
					((Component)val).gameObject.AddComponent<NukeTree>();
				}
			}
		}

		public void UpdateToolProperties()
		{
			GameObject[] randomWeapon = _humanoid.m_randomWeapon;
			object obj;
			if (randomWeapon == null)
			{
				obj = null;
			}
			else
			{
				GameObject? obj2 = randomWeapon.FirstOrDefault();
				obj = ((obj2 != null) ? obj2.GetComponent<ItemDrop>() : null);
			}
			ItemDrop val = (ItemDrop)obj;
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Failed to update tool properties: tool is null");
				return;
			}
			val.m_itemData.m_shared.m_damages.m_chop = ToolDamage;
			val.m_itemData.m_shared.m_toolTier = ToolTier;
		}

		protected virtual void Awake()
		{
			_monsterAI = ((Component)this).GetComponent<MonsterAI>();
			_humanoid = ((Component)this).GetComponent<Humanoid>();
			_monsterAI.m_alertRange = 1f;
			((BaseAI)_monsterAI).m_randomMoveRange = RoamRange;
			UpdateToolProperties();
		}

		protected virtual void FixedUpdate()
		{
			//IL_00fa: 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_0102: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			GameObject followTarget = _monsterAI.GetFollowTarget();
			if ((Object)(object)followTarget != (Object)null)
			{
				Player val = default(Player);
				if (followTarget.TryGetComponent<Player>(ref val))
				{
					string text = LocalizationManager.Instance.TryTranslate("$chebgonaz_minionstatus_following");
					_status = text + " " + val.GetPlayerName();
					return;
				}
				if (ChatInterval != 0f && Time.time > _lastChat + ChatInterval)
				{
					_lastChat = Time.time;
					List<Player> list = new List<Player>();
					Player.GetPlayersInRange(((Component)this).transform.position, ChatDistance, list);
					if (list.Count > 0)
					{
						string text2 = LocalizationManager.Instance.TryTranslate("$chebgonaz_worker_target");
						Chat.instance.SetNpcText(((Component)this).gameObject, Vector3.up, 5f, 10f, "", text2 + ": " + ((Object)followTarget.gameObject).name, false);
					}
				}
				Vector3 position = followTarget.transform.position;
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(position.x, ((Component)this).transform.position.y, position.z);
				((Component)this).transform.LookAt(val2);
				TryAttack(val2);
			}
			if (Time.time > _nextCheck)
			{
				_nextCheck = Time.time + UpdateDelay + Random.value;
				LookForCuttableObjects();
				if ((Object)(object)_monsterAI.GetFollowTarget() == (Object)null)
				{
					_status = LocalizationManager.Instance.TryTranslate("$chebgonaz_worker_cantfindtarget");
				}
				((Character)_humanoid).m_name = _status;
			}
		}

		private void TryAttack(Vector3 lookAtPos)
		{
			//IL_0046: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			if ((Object)(object)_humanoid == (Object)null || (Object)(object)_monsterAI == (Object)null || _chopping)
			{
				return;
			}
			GameObject followTarget = _monsterAI.GetFollowTarget();
			if (!((Object)(object)followTarget != (Object)null) || (!_inContact && !(Vector3.Distance(lookAtPos, ((Component)this).transform.position) < 1.5f)))
			{
				return;
			}
			Destructible destructible = followTarget.GetComponentInParent<Destructible>();
			if ((Object)(object)destructible != (Object)null && (int)destructible.GetDestructibleType() == 2)
			{
				((MonoBehaviour)this).StartCoroutine(Chop(destructible.m_health, (IDestructible)(object)destructible, () => destructible.m_health));
				return;
			}
			TreeLog treeLog = followTarget.GetComponentInParent<TreeLog>();
			if ((Object)(object)treeLog != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(Chop(treeLog.m_health, (IDestructible)(object)treeLog, () => treeLog.m_health));
				return;
			}
			TreeBase tree = followTarget.GetComponentInParent<TreeBase>();
			if ((Object)(object)tree != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(Chop(tree.m_health, (IDestructible)(object)treeLog, () => tree.m_health));
			}
		}

		private IEnumerator Chop(float healthBeforeAttack, IDestructible destructible, Func<float> healthAfterDamaged)
		{
			_chopping = true;
			_monsterAI.DoAttack((Character)null, false);
			yield return (object)new WaitForSeconds(2f);
			if (healthAfterDamaged() < healthBeforeAttack)
			{
				_chopping = false;
				yield break;
			}
			HitData val = new HitData();
			val.m_damage.m_chop = ToolDamage;
			val.m_toolTier = ToolTier;
			if (destructible != null)
			{
				destructible.Damage(val);
			}
			_chopping = false;
		}

		private void OnCollisionEnter(Collision collision)
		{
			_inContact = Hittable((collision != null) ? collision.gameObject : null);
		}

		private void OnCollisionExit(Collision other)
		{
			_inContact = Hittable((other != null) ? other.gameObject : null);
		}

		private bool Hittable(GameObject go)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			Destructible componentInParent = go.GetComponentInParent<Destructible>();
			if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.GetDestructibleType() == 2)
			{
				return true;
			}
			if ((Object)(object)go.GetComponentInParent<TreeLog>() != (Object)null)
			{
				return true;
			}
			if ((Object)(object)go.GetComponentInParent<TreeBase>() != (Object)null)
			{
				return true;
			}
			return false;
		}
	}
}
namespace ChebsValheimLibrary.Items
{
	public enum CraftingTable
	{
		None,
		[InternalName("piece_workbench")]
		Workbench,
		[InternalName("piece_cauldron")]
		Cauldron,
		[InternalName("forge")]
		Forge,
		[InternalName("piece_artisanstation")]
		ArtisanTable,
		[InternalName("piece_stonecutter")]
		StoneCutter,
		[InternalName("blackforge")]
		BlackForge
	}
	public class Item
	{
		public ConfigEntry<bool> Allowed;

		protected float DoOnUpdateDelay;

		public virtual string ItemName => "";

		public virtual string PrefabName => "";

		public virtual string NameLocalization => "";

		public virtual string DescriptionLocalization => "";

		protected virtual string DefaultRecipe => "";

		public virtual void CreateConfigs(BaseUnityPlugin plugin)
		{
		}

		public virtual void UpdateRecipe()
		{
		}

		public virtual void UpdateRecipe(ConfigEntry<CraftingTable> craftingStationRequired, ConfigEntry<string> craftingCost, ConfigEntry<int> craftingStationLevel)
		{
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			ItemManager instance = ItemManager.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				CustomItem item = instance.GetItem(ItemName);
				if (item == null)
				{
					obj = null;
				}
				else
				{
					CustomRecipe recipe = item.Recipe;
					obj = ((recipe != null) ? recipe.Recipe : null);
				}
			}
			Recipe val = (Recipe)obj;
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)("Failed to update recipe for " + ItemName + " because ItemManager returned null for " + ItemName + "."));
				return;
			}
			if (craftingStationRequired == null)
			{
				Logger.LogError((object)("Failed to update recipe for " + ItemName + " because CraftingStationRequired is null."));
				return;
			}
			if (craftingCost == null)
			{
				Logger.LogError((object)("Failed to update recipe for " + ItemName + " because CraftingCost is null."));
				return;
			}
			if (craftingStationLevel == null)
			{
				Logger.LogError((object)("Failed to update recipe for " + ItemName + " because CraftingStationLevel is null."));
				return;
			}
			string name = InternalName.GetName(craftingStationRequired.Value);
			val.m_minStationLevel = craftingStationLevel.Value;
			PrefabManager instance2 = PrefabManager.Instance;
			GameObject val2 = ((instance2 != null) ? instance2.GetPrefab(name) : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Logger.LogError((object)("Failed to update recipe for " + ItemName + " because of failure to get " + name + " from ZNetScene.instance."));
				return;
			}
			val.m_craftingStation = val2.GetComponent<CraftingStation>();
			List<Requirement> list = new List<Requirement>();
			string[] array = craftingCost.Value.Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				string[] array2 = array[i].Split(new char[1] { ':' });
				string text = array2[0];
				int num = int.Parse(array2[1]);
				PrefabManager instance3 = PrefabManager.Instance;
				GameObject val3 = ((instance3 != null) ? instance3.GetPrefab(text) : null);
				if ((Object)(object)val3 == (Object)null)
				{
					Logger.LogError((object)("Failed to update recipe for " + ItemName + " because of failure to get " + text + "'s prefab from ZNetScene.instance."));
				}
				else
				{
					list.Add(new Requirement
					{
						m_amount = num,
						m_amountPerLevel = num * 2,
						m_resItem = val3.GetComponent<ItemDrop>()
					});
				}
			}
			val.m_resources = list.ToArray();
		}

		protected void SetRecipeReqs(ItemConfig recipeConfig, ConfigEntry<string> craftingCost, ConfigEntry<CraftingTable> craftingStationRequired, ConfigEntry<int> craftingStationLevel)
		{
			recipeConfig.CraftingStation = ((InternalName)typeof(CraftingTable).GetMember(craftingStationRequired.Value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).Name;
			if (Enumerable.Contains(craftingCost.Value, ','))
			{
				string[] array = craftingCost.Value.Split(new char[1] { ',' });
				for (int i = 0; i < array.Length; i++)
				{
					AddMaterial(array[i]);
				}
			}
			else
			{
				AddMaterial(craftingCost.Value);
			}
			recipeConfig.MinStationLevel = craftingStationLevel.Value;
			void AddMaterial(string material)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Expected O, but got Unknown
				string[] array2 = material.Split(new char[1] { ':' });
				string text = array2[0];
				int num = int.Parse(array2[1]);
				recipeConfig.AddRequirement(new RequirementConfig(text, num, num * 2, false));
			}
		}

		public virtual void DoOnUpdate()
		{
		}

		public virtual CustomItem GetCustomItemFromPrefab(GameObject prefab)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			ItemConfig val = new ItemConfig();
			val.Name = NameLocalization;
			val.Description = DescriptionLocalization;
			CustomItem val2 = new CustomItem(prefab, false, val);
			if ((Object)(object)val2.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)("GetCustomItemFromPrefab: " + PrefabName + "'s ItemPrefab is null!"));
				return null;
			}
			return val2;
		}
	}
}
namespace ChebsValheimLibrary.Items.Weapons.Wood
{
	public class SkeletonClub : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonClub";

		public override string PrefabName => "ChebGonaz_SkeletonClub.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonclub_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonclub_desc";
	}
}
namespace ChebsValheimLibrary.Items.Weapons.Poison
{
	public class SkeletonMace : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMace";

		public override string PrefabName => "ChebGonaz_SkeletonMace.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonmace_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonmace_desc";
	}
	public class SkeletonMace2 : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMace2";

		public override string PrefabName => "ChebGonaz_SkeletonMace2.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonmace_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonmace_desc";
	}
	public class SkeletonMace3 : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMace3";

		public override string PrefabName => "ChebGonaz_SkeletonMace3.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonmace_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonmace_desc";
	}
}
namespace ChebsValheimLibrary.Items.Weapons.Needle
{
	public class SkeletonMaceNeedle : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMaceNeedle";

		public override string PrefabName => "ChebGonaz_SkeletonMaceNeedle.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonmaceneedle_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonmaceneedle_desc";
	}
}
namespace ChebsValheimLibrary.Items.Weapons.Mage
{
	public class SkeletonFireballLevel1 : Item
	{
		public override string ItemName => "ChebGonaz_FireballLevel1";

		public override string PrefabName => "ChebGonaz_FireballLevel1.prefab";

		public override string NameLocalization => "$item_chebgonaz_fireballlevel1_name";

		public override string DescriptionLocalization => "$item_chebgonaz_fireballlevel1_desc";
	}
	public class SkeletonFireballLevel2 : Item
	{
		public override string ItemName => "ChebGonaz_FireballLevel2";

		public override string PrefabName => "ChebGonaz_FireballLevel2.prefab";

		public override string NameLocalization => "$item_chebgonaz_fireballlevel2_name";

		public override string DescriptionLocalization => "$item_chebgonaz_fireballlevel2_desc";
	}
	public class SkeletonFireballLevel3 : Item
	{
		public override string ItemName => "ChebGonaz_FireballLevel3";

		public override string PrefabName => "ChebGonaz_FireballLevel3.prefab";

		public override string NameLocalization => "$item_chebgonaz_fireballlevel3_name";

		public override string DescriptionLocalization => "$item_chebgonaz_fireballlevel3_desc";
	}
}
namespace ChebsValheimLibrary.Items.Weapons.Iron
{
	public class SkeletonAxe : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonAxe";

		public override string PrefabName => "ChebGonaz_SkeletonAxe.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonaxe_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonaxe_desc";
	}
	public class SkeletonMaceIron : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMaceIron";

		public override string PrefabName => "ChebGonaz_SkeletonMaceIron.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonmaceiron_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonmaceiron_desc";
	}
	public class SkeletonSwordIron : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonSwordIron";

		public override string PrefabName => "ChebGonaz_SkeletonSwordIron.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonswordiron_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonswordiron_desc";
	}
}
namespace ChebsValheimLibrary.Items.Weapons.Bronze
{
	public class SkeletonAxeBronze : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonAxeBronze";

		public override string PrefabName => "ChebGonaz_SkeletonAxeBronze.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonaxebronze_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonaxebronze_desc";
	}
	public class SkeletonMaceBronze : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMaceBronze";

		public override string PrefabName => "ChebGonaz_SkeletonMaceBronze.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonmacebronze_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonmacebronze_desc";
	}
	public class SkeletonSwordBronze : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonSwordBronze";

		public override string PrefabName => "ChebGonaz_SkeletonSwordBronze.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonswordbronze_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonswordbronze_desc";
	}
}
namespace ChebsValheimLibrary.Items.Weapons.Bows
{
	public class SkeletonBow : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonBow";

		public override string PrefabName => "ChebGonaz_SkeletonBow.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonbow_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonbow_desc";
	}
	public class SkeletonBow2 : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonBow2";

		public override string PrefabName => "ChebGonaz_SkeletonBow2.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonbow2_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonbow2_desc";
	}
	public class SkeletonBow3 : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonBow3";

		public override string PrefabName => "ChebGonaz_SkeletonBow3.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonbow3_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonbow3_desc";
	}
	public class SkeletonBowFire : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonBowFire";

		public override string PrefabName => "ChebGonaz_SkeletonBowFire.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonbowfire_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonbowfire_desc";
	}
	public class SkeletonBowFrost : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonBowFrost";

		public override string PrefabName => "ChebGonaz_SkeletonBowFrost.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonbowfrost_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonbowfrost_desc";
	}
	public class SkeletonBowPoison : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonBowPoison";

		public override string PrefabName => "ChebGonaz_SkeletonBowPoison.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonbowpoison_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonbowpoison_desc";
	}
	public class SkeletonBowSilver : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonBowSilver";

		public override string PrefabName => "ChebGonaz_SkeletonBowSilver.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonbowsilver_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonbowsilver_desc";
	}
}
namespace ChebsValheimLibrary.Items.Weapons.BlackMetal
{
	public class SkeletonAxeBlackMetal : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonAxeBlackMetal";

		public override string PrefabName => "ChebGonaz_SkeletonAxeBlackMetal.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonaxeblackmetal_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonaxeblackmetal_desc";
	}
	public class SkeletonMaceBlackMetal : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMaceBlackMetal";

		public override string PrefabName => "ChebGonaz_SkeletonMaceBlackMetal.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonmaceblackmetal_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonmaceblackmetal_desc";
	}
	public class SkeletonSwordBlackMetal : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonSwordBlackMetal";

		public override string PrefabName => "ChebGonaz_SkeletonSwordBlackMetal.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonswordblackmetal_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonswordblackmetal_desc";
	}
}
namespace ChebsValheimLibrary.Items.Tools
{
	public class SkeletonPickaxe : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonPickaxe";

		public override string PrefabName => "ChebGonaz_SkeletonPickaxe.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonpickaxe_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonpickaxe_desc";
	}
	public class SkeletonWoodAxe : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonWoodAxe";

		public override string PrefabName => "ChebGonaz_SkeletonWoodAxe.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonaxe_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonaxe_desc";
	}
}
namespace ChebsValheimLibrary.Items.Armor.Mage
{
	public class SkeletonMageCirclet : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonMageCirclet";

		public override string PrefabName => "ChebGonaz_SkeletonMageCirclet.prefab";

		public override string NameLocalization => "$item_chebgonaz_magecirclet_name";

		public override string DescriptionLocalization => "$item_chebgonaz_magecirclet_desc";
	}
}
namespace ChebsValheimLibrary.Items.Armor.Leather
{
	public class SkeletonHelmetLeather : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeather";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeather.prefab";

		public override string NameLocalization => "$item_helmet_leather";

		public override string DescriptionLocalization => "$item_helmet_leather_description";
	}
	public class SkeletonHelmetLeatherPoison : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeatherPoison";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeatherPoison.prefab";

		public override string NameLocalization => "$item_helmet_leather";

		public override string DescriptionLocalization => "$item_helmet_leather_description";
	}
}
namespace ChebsValheimLibrary.Items.Armor.Leather.Wolf
{
	public class HelmetLeatherWolf : Item
	{
		public override string ItemName => "ChebGonaz_HelmetLeatherWolf";

		public override string PrefabName => "ChebGonaz_HelmetLeatherWolf.prefab";

		public override string NameLocalization => "$item_helmet_leather_wolf";

		public override string DescriptionLocalization => "$item_helmet_leather_description_wolf";
	}
	public class SkeletonArmorLeatherChestWolf : Item
	{
		public override string ItemName => "ChebGonaz_ArmorLeatherChestWolf";

		public override string PrefabName => "ChebGonaz_ArmorLeatherChestWolf.prefab";

		public override string NameLocalization => "$item_chest_leather_wolf";

		public override string DescriptionLocalization => "$item_chest_leather_description_wolf";
	}
	public class SkeletonArmorLeatherLegsWolf : Item
	{
		public override string ItemName => "ChebGonaz_ArmorLeatherLegsWolf";

		public override string PrefabName => "ChebGonaz_ArmorLeatherLegsWolf.prefab";

		public override string NameLocalization => "$item_legs_leather_wolf";

		public override string DescriptionLocalization => "$item_legs_leather_description_wolf";
	}
	public class SkeletonHelmetLeatherPoisonWolf : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeatherPoisonWolf";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeatherPoisonWolf.prefab";

		public override string NameLocalization => "$item_helmet_leather_wolf_poison";

		public override string DescriptionLocalization => "$item_helmet_leather_wolf_poison_desc";
	}
	public class SkeletonHelmetLeatherWolf : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeatherWolf";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeatherWolf.prefab";

		public override string NameLocalization => "$item_helmet_leather_wolf";

		public override string DescriptionLocalization => "$item_helmet_leather_description_wolf";
	}
}
namespace ChebsValheimLibrary.Items.Armor.Leather.Troll
{
	public class SkeletonArmorLeatherChestTroll : Item
	{
		public override string ItemName => "ChebGonaz_ArmorLeatherChestTroll";

		public override string PrefabName => "ChebGonaz_ArmorLeatherChestTroll.prefab";

		public override string NameLocalization => "$item_chest_leather_troll";

		public override string DescriptionLocalization => "$item_chest_leather_description_troll";
	}
	public class SkeletonArmorLeatherLegsTroll : Item
	{
		public override string ItemName => "ChebGonaz_ArmorLeatherLegsTroll";

		public override string PrefabName => "ChebGonaz_ArmorLeatherLegsTroll.prefab";

		public override string NameLocalization => "$item_legs_leather_troll";

		public override string DescriptionLocalization => "$item_legs_leather_description_troll";
	}
	public class SkeletonHelmetLeatherPoisonTroll : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeatherPoisonTroll";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeatherPoisonTroll.prefab";

		public override string NameLocalization => "$item_helmet_leather_troll_poison";

		public override string DescriptionLocalization => "$item_helmet_leather_description_troll_poison";
	}
	public class SkeletonHelmetLeatherTroll : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeatherTroll";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeatherTroll.prefab";

		public override string NameLocalization => "$item_helmet_leather_troll";

		public override string DescriptionLocalization => "$item_helmet_leather_description_troll";
	}
}
namespace ChebsValheimLibrary.Items.Armor.Leather.Lox
{
	public class HelmetLeatherLox : Item
	{
		public override string ItemName => "ChebGonaz_HelmetLeatherLox";

		public override string PrefabName => "ChebGonaz_HelmetLeatherLox.prefab";

		public override string NameLocalization => "$item_helmet_leather_lox";

		public override string DescriptionLocalization => "$item_helmet_leather_description_lox";
	}
	public class SkeletonArmorLeatherChestLox : Item
	{
		public override string ItemName => "ChebGonaz_ArmorLeatherChestLox";

		public override string PrefabName => "ChebGonaz_ArmorLeatherChestLox.prefab";

		public override string NameLocalization => "$item_chest_leather_lox";

		public override string DescriptionLocalization => "$item_chest_leather_description_lox";
	}
	public class SkeletonArmorLeatherLegsLox : Item
	{
		public override string ItemName => "ChebGonaz_ArmorLeatherLegsLox";

		public override string PrefabName => "ChebGonaz_ArmorLeatherLegsLox.prefab";

		public override string NameLocalization => "$item_legs_leather_lox";

		public override string DescriptionLocalization => "$item_legs_leather_description_lox";
	}
	public class SkeletonHelmetLeatherLox : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeatherLox";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeatherLox.prefab";

		public override string NameLocalization => "$item_helmet_leather_lox";

		public override string DescriptionLocalization => "$item_helmet_leather_description_lox";
	}
	public class SkeletonHelmetLeatherPoisonLox : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetLeatherPoisonLox";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetLeatherPoisonLox.prefab";

		public override string NameLocalization => "$item_helmet_leather_troll_lox";

		public override string DescriptionLocalization => "$item_helmet_leather_description_lox_poison";
	}
	public class HelmetLeatherTroll : Item
	{
		public override string ItemName => "ChebGonaz_HelmetLeatherTroll";

		public override string PrefabName => "ChebGonaz_HelmetLeatherTroll.prefab";

		public override string NameLocalization => "$item_helmet_leather_troll";

		public override string DescriptionLocalization => "$item_helmet_leather_description_troll";
	}
}
namespace ChebsValheimLibrary.Items.Armor.Iron
{
	public class SkeletonHelmetIron : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetIron";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetIron.prefab";

		public override string NameLocalization => "$item_helmet_iron";

		public override string DescriptionLocalization => "$item_helmet_iron_description";
	}
	public class SkeletonHelmetIronPoison : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetIronPoison";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetIronPoison.prefab";

		public override string NameLocalization => "$item_helmet_iron";

		public override string DescriptionLocalization => "$item_helmet_iron_description";
	}
}
namespace ChebsValheimLibrary.Items.Armor.Bronze
{
	public class SkeletonHelmetBronze : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetBronze";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetBronze.prefab";

		public override string NameLocalization => "$item_helmet_bronze";

		public override string DescriptionLocalization => "$item_helmet_bronze_description";
	}
	public class SkeletonHelmetBronzePoison : Item
	{
		public override string ItemName => "ChebGonaz_SkeletonHelmetBronzePoison";

		public override string PrefabName => "ChebGonaz_SkeletonHelmetBronzePoison.prefab";

		public override string NameLocalization => "$item_helmet_bronze";

		public override string DescriptionLocalization => "$item_helmet_bronze_description";
	}
}
namespace ChebsValheimLibrary.Items.Armor.BlackMetal
{
	public class BlackIronChest : Item
	{
		public override string ItemName => "ChebGonaz_ArmorBlackIronChest";

		public override string PrefabName => "ChebGonaz_ArmorBlackIronChest.prefab";

		public override string NameLocalization => "$item_chebgonaz_blackironchest_name";

		public override string DescriptionLocalization => "$item_chebgonaz_blackironchest_desc";

		protected override string DefaultRecipe => "BlackMetal:5";
	}
	public class BlackIronHelmet : Item
	{
		public override string ItemName => "ChebGonaz_HelmetBlackIron";

		public override string PrefabName => "ChebGonaz_HelmetBlackIron.prefab";

		public override string NameLocalization => "$item_chebgonaz_blackironhelmet_name";

		public override string DescriptionLocalization => "$item_chebgonaz_blackironhelmet_desc";

		protected override string DefaultRecipe => "BlackMetal:5";
	}
	public class BlackIronLegs : Item
	{
		public override string ItemName => "ChebGonaz_ArmorBlackIronLegs";

		public override string PrefabName => "ChebGonaz_ArmorBlackIronLegs.prefab";

		public override string NameLocalization => "$item_chebgonaz_blackironlegs_name";

		public override string DescriptionLocalization => "$item_chebgonaz_blackironlegs_desc";

		protected override string DefaultRecipe => "BlackMetal:5";
	}
	public class SkeletonHelmetBlackIron : Item
	{
		public override string ItemName => "ChebGonaz_HelmetBlackIronSkeleton";

		public override string PrefabName => "ChebGonaz_HelmetBlackIronSkeleton.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonblackironhelmet_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonblackironhelmet_desc";
	}
	public class SkeletonHelmetBlackIronPoison : Item
	{
		public override string ItemName => "ChebGonaz_HelmetBlackIronSkeletonPoison";

		public override string PrefabName => "ChebGonaz_HelmetBlackIronSkeletonPoison.prefab";

		public override string NameLocalization => "$item_chebgonaz_skeletonblackironhelmet_name";

		public override string DescriptionLocalization => "$item_chebgonaz_skeletonblackironhelmet_desc";
	}
}
namespace ChebsValheimLibrary.Common
{
	public class ChebsRecipe
	{
		public string RecipeValue = "<Prefab1>:<quantity>[[,<PreFab2>:<quantity>], ...]";

		public ConfigEntry<bool> Allowed { get; set; }

		public ConfigEntry<string> CraftingCost { get; set; }

		public string DefaultRecipe { get; set; }

		public string PieceTable { get; set; }

		public string PieceCategory { get; set; }

		public string PieceName { get; set; }

		public string PieceDescription { get; set; }

		public string PrefabName { get; set; }

		public string IconName { get; set; }

		public string ObjectName { get; set; }

		public virtual void UpdateRecipe(ConfigEntry<string> craftingCost)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			string text = PrefabName.Split(new char[1] { '.' })[0];
			Piece piece = PieceManager.Instance.GetPiece(text).Piece;
			List<Requirement> list = new List<Requirement>();
			string[] array = craftingCost.Value.Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				string[] array2 = array[i].Split(new char[1] { ':' });
				string text2 = array2[0];
				int num = int.Parse(array2[1]);
				list.Add(new Requirement
				{
					m_amount = num,
					m_amountPerLevel = num * 2,
					m_resItem = ZNetScene.instance.GetPrefab(text2).GetComponent<ItemDrop>()
				});
			}
			piece.m_resources = list.ToArray();
		}

		public CustomPiece GetCustomPieceFromPrefab(GameObject prefab, Sprite icon)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			PieceConfig val = new PieceConfig
			{
				Name = PieceName,
				Description = PieceDescription
			};
			if (Allowed.Value)
			{
				if (string.IsNullOrEmpty(CraftingCost.Value))
				{
					CraftingCost.Value = DefaultRecipe;
				}
				SetRecipeReqs(val, CraftingCost);
			}
			else
			{
				val.Enabled = false;
			}
			val.Icon = icon;
			val.PieceTable = PieceTable;
			val.Category = PieceCategory;
			CustomPiece val2 = new CustomPiece(prefab, false, val);
			if (val2 == null)
			{
				Logger.LogError((object)("AddCustomPieces: " + PrefabName + "'s CustomPiece is null!"));
				return null;
			}
			if ((Object)(object)val2.PiecePrefab == (Object)null)
			{
				Logger.LogError((object)("AddCustomPieces: " + PrefabName + "'s PiecePrefab is null!"));
				return null;
			}
			return val2;
		}

		private void SetRecipeReqs(PieceConfig config, ConfigEntry<string> craftingCost)
		{
			if (Enumerable.Contains(craftingCost.Value, ','))
			{
				string[] array = craftingCost.Value.Split(new char[1] { ',' });
				for (int i = 0; i < array.Length; i++)
				{
					addMaterial(array[i]);
				}
			}
			else
			{
				addMaterial(craftingCost.Value);
			}
			void addMaterial(string material)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				string[] array2 = material.Split(new char[1] { ':' });
				string text = array2[0];
				int num = int.Parse(array2[1]);
				config.AddRequirement(new RequirementConfig(text, num, 0, true));
			}
		}
	}
	public class InternalName : Attribute
	{
		public readonly string Name;

		public InternalName(string internalName)
		{
			Name = internalName;
		}

		public static string GetName(Enum value)
		{
			Type type = value.GetType();
			string name = Enum.GetName(type, value);
			return (type.GetField(name).GetCustomAttributes(typeof(InternalName), inherit: false).FirstOrDefault() as InternalName)?.Name ?? value.ToString();
		}
	}
	public class MemoryConfigEntry<T, TT>
	{
		private readonly Func<T, TT> _processValueFunc;

		private T _lastKnownValue;

		private TT _processedValue;

		private readonly ConfigEntry<T> _configEntry;

		public TT Value => _processedValue;

		public ConfigEntry<T> ConfigEntry => _configEntry;

		public MemoryConfigEntry(ConfigEntry<T> configEntry, Func<T, TT> processValueFunc)
		{
			_configEntry = configEntry;
			_processValueFunc = processValueFunc;
			_lastKnownValue = _configEntry.Value;
			_processedValue = _processValueFunc(_lastKnownValue);
			if (configEntry == null)
			{
				Logger.LogError((object)"MemoryConfigEntry: configEntry is null!");
			}
			else
			{
				_configEntry.SettingChanged += OnConfigEntryValueChanged;
			}
		}

		private void OnConfigEntryValueChanged(object sender, EventArgs args)
		{
			T value = _configEntry.Value;
			if (value == null)
			{
				Logger.LogError((object)"MemoryConfigEntry.OnConfigEntryValueChanged: value is null!");
			}
			else if (!EqualityComparer<T>.Default.Equals(value, _lastKnownValue))
			{
				Logger.LogInfo((object)$"MemoryConfigEntry.OnConfigEntryValueChanged: value is new! {value}");
				_lastKnownValue = value;
				_processedValue = _processValueFunc(value);
			}
		}
	}
	public static class Weather
	{
		public enum Env
		{
			None,
			[InternalName("Clear")]
			Clear,
			[InternalName("Twilight_Clear")]
			TwilightClear,
			[InternalName("Misty")]
			Misty,
			[InternalName("Darklands_dark")]
			DarklandsDark,
			[InternalName("Heath_clear")]
			HeathClear,
			[InternalName("DeepForest")]
			DeepForest,
			[InternalName("Mist")]
			Mist,
			[InternalName("GDKing")]
			GDKing,
			[InternalName("Rain")]
			Rain,
			[InternalName("LightRain")]
			LightRain,
			[InternalName("ThunderStorm")]
			ThunderStorm,
			[InternalName("Eikthyr")]
			Eikthyr,
			[InternalName("GoblinKing")]
			GoblinKing,
			[InternalName("nofogts")]
			Nofogts,
			[InternalName("SwampRain")]
			SwampRain,
			[InternalName("Bonemass")]
			Bonemass,
			[InternalName("Snow")]
			Snow,
			[InternalName("Twilight_Snow")]
			TwilightSnow,
			[InternalName("Twilight_SnowStorm")]
			TwilightSnowStorm,
			[InternalName("SnowStorm")]
			SnowStorm,
			[InternalName("Moder")]
			Moder,
			[InternalName("Ashrain")]
			Ashrain,
			[InternalName("Crypt")]
			Crypt,
			[InternalName("SunkenCrypt")]
			SunkenCrypt
		}
	}
}