Decompiled source of WeedheimArmor v1.0.2

plugins/WeedheimArmor.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Extensions;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using WeedheimArmor.Effects;
using WeedheimArmor.Updates;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("WeedheimArmor")]
[assembly: AssemblyDescription("https://discord.gg/zRucjV8rqc")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MagicMike")]
[assembly: AssemblyProduct("WeedheimArmor")]
[assembly: AssemblyCopyright("Copyright © MagicMike 2025WeedheimArmor")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WeedheimArmor
{
	internal class TradersPatch
	{
		[HarmonyPatch(typeof(Trader), "GetAvailableItems")]
		public static class GetAvailableItemsPatch
		{
			[HarmonyPriority(200)]
			private static void Postfix(Trader __instance, ref List<TradeItem> __result)
			{
				if (__instance.m_name.Equals("Loki"))
				{
					string name = ((Object)Cache.GetPrefab<GameObject>("ArmorHempCape")).name;
					__result.Add(CreateCustomItem(name, 1, 200, "defeated_eikthyr"));
					string name2 = ((Object)Cache.GetPrefab<GameObject>("ArmorHempChest")).name;
					__result.Add(CreateCustomItem(name2, 1, 200, "defeated_eikthyr"));
					string name3 = ((Object)Cache.GetPrefab<GameObject>("ArmorHempHelmet")).name;
					__result.Add(CreateCustomItem(name3, 1, 200, "defeated_eikthyr"));
					string name4 = ((Object)Cache.GetPrefab<GameObject>("ArmorHempLegs")).name;
					__result.Add(CreateCustomItem(name4, 1, 200, "defeated_eikthyr"));
				}
			}

			private static TradeItem CreateCustomItem(string itemName, int stackSize, int price, string key)
			{
				//IL_0011: 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_001d: 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_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Expected O, but got Unknown
				ItemDrop component = ObjectDB.instance.GetItemPrefab(itemName).GetComponent<ItemDrop>();
				return new TradeItem
				{
					m_prefab = component,
					m_stack = stackSize,
					m_price = price,
					m_requiredGlobalKey = key
				};
			}
		}
	}
	internal class FileWatcher
	{
		public static void WatchFileChanges(string path, Action onChanged)
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher();
			string directoryName = Path.GetDirectoryName(path);
			string fileName = Path.GetFileName(path);
			fileSystemWatcher.Path = directoryName;
			fileSystemWatcher.Filter = fileName;
			fileSystemWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
			fileSystemWatcher.Changed += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.Deleted += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.Created += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.Renamed += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		public static void WatchTranslationChanges(string path, Action onChanged)
		{
			if (!Directory.Exists(WeedheimArmorMod.TranslationFilePath))
			{
				return;
			}
			try
			{
				WatchFileChanges(Path.Combine(path, "*.*"), onChanged);
			}
			catch
			{
				Logger.LogError((object)"There was an issue loading Translation files!");
			}
		}
	}
	internal static class LocalisedText
	{
		public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

		public static void AddLocalisations()
		{
			CustomLocalization localization = Localization;
			string text = "English";
			localization.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "item_hemparmor_chest", "Hemp Armor Chest" },
				{ "item_hemparmor_chest_desc", "These artfully layered robes have rock burns and ash marks in every seam and fold." },
				{ "item_hemparmor_legs", "Hemp Armor Leg" },
				{ "item_hemparmor_legs_desc", "These trousers are tight tight tight!" },
				{ "item_hemparmor_cape", "Hemp Armor Cape" },
				{ "item_hemparmor_cape_desc", "Donning this cape makes you feel closer to Jah!" },
				{ "item_hemparmor_helmet", "Hemp Armor Helmet" },
				{ "item_hemparmor_helmet_desc", "Loki wishes they made these for his head size." },
				{ "item_hemparmor_banded", "Cool Banded Shield" },
				{ "item_hemparmor_banded_desc", "Reinforced with a mix of hemp and iron, a true stoner's companion!" },
				{ "item_hemparmor_tower", "Cool Tower Shield" },
				{ "item_hemparmor_tower_desc", "Reinforced with a mix of hemp and iron, a true stoner's companion!" }
			});
			CustomLocalization localization2 = Localization;
			text = "English";
			localization2.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "armor_hemp_effect_name", "Awesome Armor" },
				{ "armor_hemp_effect_tooltip", "Makes you more awesome!" },
				{ "armor_hemp_effect_start", "You feel awesome! :)" },
				{ "armor_hemp_effect_stop", "You don't feel so awesome! :(" },
				{ "cape_hemp_effect_name", "Floating High!" },
				{ "cape_hemp_effect_tooltip", "Makes jumping more fun!" },
				{ "cape_hemp_effect_start", "Float like a butterfly!" },
				{ "cape_hemp_effect_stop", "No more floating!" }
			});
		}
	}
	internal class MainConfig
	{
		internal const string GeneralSection = "General_Settings";

		internal static ConfigEntry<bool> enablePlugin;

		internal const string LegsHempArmor = "Legs_Hemp_Armor";

		internal static ConfigEntry<float> legsDurability;

		internal static ConfigEntry<float> legsMaxDurability;

		internal static ConfigEntry<float> legsDurabilityPerLevel;

		internal static ConfigEntry<float> legsArmor;

		internal static ConfigEntry<float> legsArmorPerLevel;

		internal static ConfigEntry<float> legsEitrRegen;

		internal static ConfigEntry<float> legsMovement;

		internal static ConfigEntry<float> legsHeat;

		internal static ConfigEntry<float> legsJump;

		internal static ConfigEntry<float> legsRun;

		internal const string ChestHempArmor = "Chest_Hemp_Armor";

		internal static ConfigEntry<float> chestDurability;

		internal static ConfigEntry<float> chestMaxDurability;

		internal static ConfigEntry<float> chestDurabilityPerLevel;

		internal static ConfigEntry<float> chestArmor;

		internal static ConfigEntry<float> chestArmorPerLevel;

		internal static ConfigEntry<float> chestEitrRegen;

		internal static ConfigEntry<float> chestMovement;

		internal static ConfigEntry<float> chestHeat;

		internal const string HelmetHempArmor = "Helmet_Hemp_Armor";

		internal static ConfigEntry<float> helmetDurability;

		internal static ConfigEntry<float> helmetMaxDurability;

		internal static ConfigEntry<float> helmetDurabilityPerLevel;

		internal static ConfigEntry<float> helmetArmor;

		internal static ConfigEntry<float> helmetArmorPerLevel;

		internal static ConfigEntry<float> helmetEitrRegen;

		internal static ConfigEntry<float> helmetHeat;

		internal const string CapeHempArmor = "Cape_Hemp_Armor";

		internal static ConfigEntry<float> capeDurability;

		internal static ConfigEntry<float> capeMaxDurability;

		internal static ConfigEntry<float> capeDurabilityPerLevel;

		internal static ConfigEntry<float> capeArmor;

		internal static ConfigEntry<float> capeArmorPerLevel;

		internal static ConfigEntry<float> capeRun;

		internal const string BandedHempShield = "Banded_Hemp_Shield";

		internal static ConfigEntry<float> bandedDurability;

		internal static ConfigEntry<float> bandedMaxDurability;

		internal static ConfigEntry<float> bandedDurabilityPerLevel;

		internal static ConfigEntry<float> bandedArmor;

		internal static ConfigEntry<float> bandedArmorPerLevel;

		internal static ConfigEntry<float> bandedBlockPower;

		internal static ConfigEntry<float> bandedPowerPerLevel;

		internal static ConfigEntry<float> bandedDeflectionForce;

		internal static ConfigEntry<float> bandedForcePerLevel;

		internal static ConfigEntry<float> bandedBlockedBonus;

		internal static ConfigEntry<float> bandedMovement;

		internal const string TowerHempShield = "Tower_Hemp_Shield";

		internal static ConfigEntry<float> towerDurability;

		internal static ConfigEntry<float> towerMaxDurability;

		internal static ConfigEntry<float> towerDurabilityPerLevel;

		internal static ConfigEntry<float> towerArmor;

		internal static ConfigEntry<float> towerArmorPerLevel;

		internal static ConfigEntry<float> towerBlockPower;

		internal static ConfigEntry<float> towerPowerPerLevel;

		internal static ConfigEntry<float> towerDeflectionForce;

		internal static ConfigEntry<float> towerForcePerLevel;

		internal static ConfigEntry<float> towerBlockedBonus;

		internal static ConfigEntry<float> towerMovement;

		internal const string EffectHempArmor = "Effect_Hemp_Armor";

		internal static ConfigEntry<float> armorStaminaRunVal;

		internal static ConfigEntry<float> armorStaminaJumpVal;

		internal static ConfigEntry<float> armorStaminaAttackVal;

		internal static ConfigEntry<float> armorHealthRegenVal;

		internal static ConfigEntry<float> armorStaminaRegenVal;

		internal static ConfigEntry<float> armorEitrRegenVal;

		internal const string EffectHempCape = "Effect_Hemp_Cape";

		internal static ConfigEntry<float> capeSpeedVal;

		internal static ConfigEntry<bool> capeDoubleJump;

		internal static ConfigEntry<float> capeJumpVal;

		internal static ConfigEntry<float> capeFallSpeed;

		internal static ConfigEntry<float> capeFallDamage;

		internal static ConfigEntry<float> capeWindMovement;

		internal static ConfigEntry<float> capeWindStamina;

		public static void InitConfigs(ConfigFile config)
		{
			enablePlugin = ConfigFileExtensions.BindConfigInOrder<bool>(config, "General_Settings", "EnableWeedheim", true, "Enable the Weedheim plugin.\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsDurability", 100f, "Durability of leg armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsMaxDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsMaxDurability", 1000f, "Maximum durability of leg armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsMaxDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsDurabilityPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsDurabilityPerLevel", 200f, "Durability per level for leg armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsDurabilityPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsArmor = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsArmor", 38f, "Legs armor amount.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 50f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsArmor.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsArmorPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsArmorPerLevel", 2f, "Legs armor per level amount.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsArmorPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsEitrRegen = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsEitrRegen", 0.4f, "Legs eitr regen modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsEitrRegen.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsMovement = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsMovementModifier", -0.02f, "Legs movement modifier.\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsMovement.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsHeat = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsHeatResistance", 0.2f, "Legs heat resistance modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsHeat.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsJump = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsJumpStamina", 0.02f, "Legs jump stamina modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsJump.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			legsRun = ConfigFileExtensions.BindConfigInOrder<float>(config, "Legs_Hemp_Armor", "LegsRunStamina", 0.05f, "Legs run stamina modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			legsRun.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestDurability", 100f, "Durability of chest armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestMaxDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestMaxDurability", 1000f, "Maximum durability of chest armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestMaxDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestDurabilityPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestDurabilityPerLevel", 200f, "Durability per level for chest armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestDurabilityPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestArmor = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestArmor", 38f, "Chest armor amount.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 50f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestArmor.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestArmorPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestArmorPerLevel", 2f, "Chest armor per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestArmorPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestEitrRegen = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestEitrRegen", 0.4f, "Chest eitr regen modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestEitrRegen.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestMovement = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestMovementModifier", -0.02f, "Chest movement modifier.\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestMovement.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			chestHeat = ConfigFileExtensions.BindConfigInOrder<float>(config, "Chest_Hemp_Armor", "ChestHeatResistance", 0.2f, "Chest heat resistance modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			chestHeat.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			helmetDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Helmet_Hemp_Armor", "HelmetDurability", 800f, "Durability of helmet.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			helmetDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			helmetMaxDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Helmet_Hemp_Armor", "HelmetMaxDurability", 800f, "Maximum durability of helmet.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			helmetMaxDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			helmetDurabilityPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Helmet_Hemp_Armor", "HelmetDurabilityPerLevel", 200f, "Durability per level for helmet armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			helmetDurabilityPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			helmetArmor = ConfigFileExtensions.BindConfigInOrder<float>(config, "Helmet_Hemp_Armor", "HelmetArmor", 38f, "Helmet armor amount.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			helmetArmor.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			helmetArmorPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Helmet_Hemp_Armor", "HelmetArmorPerLevel", 2f, "Helmet armor per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			helmetArmorPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			helmetEitrRegen = ConfigFileExtensions.BindConfigInOrder<float>(config, "Helmet_Hemp_Armor", "HelmetEitrRegen", 0.2f, "Helmet eitr regen modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			helmetEitrRegen.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			helmetHeat = ConfigFileExtensions.BindConfigInOrder<float>(config, "Helmet_Hemp_Armor", "HelmetHeatResistance", 0.2f, "Helmet heat resistance modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			helmetHeat.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Cape_Hemp_Armor", "CapeDurability", 400f, "Durability of cape.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeMaxDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Cape_Hemp_Armor", "CapeMaxDurability", 1200f, "Maximum durability of cape.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeMaxDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeDurabilityPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Cape_Hemp_Armor", "CapeDurabilityPerLevel", 100f, "Durability per level for cape armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeDurabilityPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeArmor = ConfigFileExtensions.BindConfigInOrder<float>(config, "Cape_Hemp_Armor", "CapeArmor", 12f, "Cape armor amount.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeArmor.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeArmorPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Cape_Hemp_Armor", "CapeArmorPerLevel", 2f, "Cape armor per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeArmorPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeRun = ConfigFileExtensions.BindConfigInOrder<float>(config, "Cape_Hemp_Armor", "CapeRunStamina", 0.05f, "Cape run stamina modifier.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeRun.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedDurability", 100f, "Durability of banded Shield.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedMaxDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedMaxDurability", 200f, "Maximum durability of banded Shield.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedMaxDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedDurabilityPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedDurabilityPerLevel", 50f, "Durability per level for banded Shield armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedDurabilityPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedArmor = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedArmor", 200f, "Banded shield armor amount.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedArmor.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedArmorPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedArmorPerLevel", 1f, "Banded shield armor per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedArmorPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedBlockPower = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedBlockPower", 114f, "Banded shield block power.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedBlockPower.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedPowerPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedPowerPerLevel", 6f, "Banded shield block power per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedPowerPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedDeflectionForce = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedDeflectionForce", 80f, "Banded shield deflection force.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 100f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedDeflectionForce.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedForcePerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedForcePerLevel", 5f, "Banded shield deflection force per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedForcePerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedBlockedBonus = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedBlockBonus", 1.5f, "Banded shield timed block bonus.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2.5f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedBlockedBonus.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			bandedMovement = ConfigFileExtensions.BindConfigInOrder<float>(config, "Banded_Hemp_Shield", "BandedMovementModifier", -0.05f, "Banded shield movement modifier.\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			bandedMovement.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerDurability", 100f, "Durability of tower Shield.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerMaxDurability = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerMaxDurability", 200f, "Maximum durability of tower Shield.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerMaxDurability.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerDurabilityPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerDurabilityPerLevel", 50f, "Durability per level for tower Shield armor.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerDurabilityPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerArmor = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerArmor", 200f, "Tower shield armor amount.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerArmor.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerArmorPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerArmorPerLevel", 1f, "Tower shield armor per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerArmorPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerBlockPower = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerBlockPower", 140f, "Tower shield block power.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 200f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerBlockPower.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerPowerPerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerPowerPerLevel", 6f, "Tower shield block power per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerPowerPerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerDeflectionForce = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerDeflectionForce", 150f, "Tower shield deflection force.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 100f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerDeflectionForce.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerForcePerLevel = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerForcePerLevel", 5f, "Tower shield deflection force per level.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerForcePerLevel.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerBlockedBonus = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerBlockBonus", 1.5f, "Tower shield timed block bonus.\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2.5f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerBlockedBonus.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			towerMovement = ConfigFileExtensions.BindConfigInOrder<float>(config, "Tower_Hemp_Shield", "TowerMovementModifier", -0.05f, "Tower shield movement modifier.\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			towerMovement.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			armorStaminaRunVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Armor", "ArmorRunStamina", -0.1f, "Percentage amount for run stamina usage. (Default 0).\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			armorStaminaRunVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			armorStaminaJumpVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Armor", "ArmorJumpStamina", -0.1f, "Percentage amount for jump stamina usage. (Default 0).\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			armorStaminaJumpVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			armorStaminaAttackVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Armor", "ArmorAttackStamina", -0.2f, "Percentage amount for attack stamina usage. (Default 0).\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			armorStaminaAttackVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			armorHealthRegenVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Armor", "ArmorHealthRegen", 1.2f, "Percentage amount for health regeneration. (Default 1).\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			armorHealthRegenVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			armorStaminaRegenVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Armor", "ArmorStaminaRegen", 1.2f, "Percentage amount for stamina regeneration. (Default 1).\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			armorStaminaRegenVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			armorEitrRegenVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Armor", "ArmorEitrRegen", 1.2f, "Percentage amount for eitr regeneration. (Default 1).\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			armorEitrRegenVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeSpeedVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Cape", "CapeSpeedModifier", 0f, "Speed modifier from cape. (Default 0).\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeSpeedVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeDoubleJump = ConfigFileExtensions.BindConfigInOrder<bool>(config, "Effect_Hemp_Cape", "CapeDoubleJump", true, "Allow double jump with cape. Full Hemp Armor set is needed for this to be activated.\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeJumpVal = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Cape", "CapeJumpModifier", 0.2f, "Jump modifier from cape. (Default 0).\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeJumpVal.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeFallSpeed = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Cape", "CapeFallSpeed", 5f, "Fall speed modifier from cape. (Default 5).\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeFallSpeed.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeFallDamage = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Cape", "CapeFallDamage", -1f, "Fall damage modifier from cape. (Default -1).\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeFallDamage.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeWindMovement = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Cape", "CapeWindMovement", 0.25f, "Wind movement modifier from cape. (Default 0).\n", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeWindMovement.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
			capeWindStamina = ConfigFileExtensions.BindConfigInOrder<float>(config, "Effect_Hemp_Cape", "CapeWindStamina", -1f, "Wind stamina modifier from cape. (Default 0).\n", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			capeWindStamina.SettingChanged += WeedheimArmorMod.OnArmorConfigChanged;
		}
	}
	[BepInPlugin("MagicMike.WeedheimArmor", "WeedheimArmor", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class WeedheimArmorMod : BaseUnityPlugin
	{
		internal const string PluginName = "WeedheimArmor";

		internal const string PluginVersion = "1.0.2";

		internal const string PluginAuthor = "MagicMike";

		internal const string PluginGUID = "MagicMike.WeedheimArmor";

		internal const string PluginCopy = "Copyright © MagicMike 2025WeedheimArmor";

		public const string PluginLink = "https://discord.gg/zRucjV8rqc";

		private static char pds = Path.DirectorySeparatorChar;

		public static readonly string _basePath = Paths.ConfigPath + pds + "Weedheim";

		public static readonly string TranslationFilePath = _basePath + pds + "Translations";

		private CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

		public static WeedheimArmorMod plugininstance;

		public static AssetBundle armoritems;

		public static string armorBundle = "wharmorbundle";

		private Harmony harmony = new Harmony("MagicMike.WeedheimArmor");

		internal static ConfigFile ConfigFile;

		internal static ConfigFileWatcher ConfigFileWatcher;

		public static bool ArmorConfigChanged = false;

		public void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			plugininstance = this;
			ConfigFile = ((BaseUnityPlugin)this).Config;
			ConfigFileWatcher = new ConfigFileWatcher(((BaseUnityPlugin)this).Config, 1000L);
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			MainConfig.InitConfigs(((BaseUnityPlugin)this).Config);
			UpdatePlugin(saveConfig: true, initialUpdate: true);
			if (MainConfig.enablePlugin.Value)
			{
				LoadAssetBundles();
				CheckForFolders();
				LocalisedText.AddLocalisations();
				LoadLocalisationData(TranslationFilePath);
				FileWatcher.WatchTranslationChanges(TranslationFilePath, delegate
				{
					LoadLocalisationData(TranslationFilePath);
				});
				PrefabManager.OnVanillaPrefabsAvailable += AddWeedheimEffects;
				PrefabManager.OnVanillaPrefabsAvailable += AddWHItems;
				harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "MagicMike.WeedheimArmor");
				ConfigFileWatcher.OnConfigFileReloaded += delegate
				{
					UpdatePlugin(saveConfig: false);
				};
				SynchronizationManager.OnConfigurationWindowClosed += delegate
				{
					UpdatePlugin();
				};
				SynchronizationManager.OnConfigurationSynchronized += delegate
				{
					UpdatePlugin();
				};
				Game.isModded = true;
			}
		}

		public void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}

		public static void LoadAssetBundles()
		{
			armoritems = AssetUtils.LoadAssetBundleFromResources(armorBundle, Assembly.GetExecutingAssembly());
			if ((Object)(object)armoritems == (Object)null)
			{
				Logger.LogError((object)("Failed to load asset bundle with name: " + armorBundle));
			}
		}

		public static void CheckForFolders()
		{
			if (!Directory.Exists(_basePath))
			{
				Logger.LogInfo((object)"Creating Weedheim Directory");
				Directory.CreateDirectory(_basePath);
			}
			if (!Directory.Exists(TranslationFilePath))
			{
				Logger.LogInfo((object)"Creating Translations folder");
				Directory.CreateDirectory(TranslationFilePath);
			}
		}

		public void LoadLocalisationData(string directory)
		{
			string[] fileSystemEntries = Directory.GetFileSystemEntries(directory, "*.json", SearchOption.AllDirectories);
			foreach (string path in fileSystemEntries)
			{
				string name = new DirectoryInfo(Path.GetDirectoryName(path)).Name;
				Path.GetFileNameWithoutExtension(path);
				Localization.AddJsonFile(name, File.ReadAllText(path));
			}
		}

		public static void AddWeedheimEffects()
		{
			try
			{
				WH_StatusEffects.LoadWeedheimEffects();
			}
			catch (Exception ex)
			{
				Logger.LogError((object)("Exception caught while adding Weedheim Armor Effects: " + ex.Message));
			}
			finally
			{
				PrefabManager.OnVanillaPrefabsAvailable -= AddWeedheimEffects;
			}
		}

		public static void AddWHItems()
		{
			try
			{
				WH_Items.AddItems();
			}
			catch (Exception ex)
			{
				Logger.LogError((object)("Exception caught while adding Weedheim Armor Items: " + ex.Message));
			}
			finally
			{
				PrefabManager.OnVanillaPrefabsAvailable -= AddWHItems;
			}
		}

		public static void OnArmorConfigChanged(object obj, EventArgs args)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!ArmorConfigChanged)
			{
				ArmorConfigChanged = true;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name.Equals("main"))
			{
				UpdateArmorSettings.ArmorSettingsChanged();
			}
		}

		private void UpdatePlugin(bool saveConfig = true, bool initialUpdate = false)
		{
			if (ArmorConfigChanged || initialUpdate)
			{
				ArmorConfigChanged = false;
			}
			if (saveConfig)
			{
				((BaseUnityPlugin)this).Config.Save();
			}
		}
	}
	internal class WH_Items
	{
		public static EffectList startShield;

		public static EffectList hitShield;

		public static EffectList blockShield;

		public static void AddItems()
		{
			LoadFX();
			AddLokisItems();
			AddBandedShield();
			AddTowerShield();
		}

		public static void LoadFX()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_009b: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			GameObject prefab = Cache.GetPrefab<GameObject>("vfx_clubhit");
			GameObject prefab2 = Cache.GetPrefab<GameObject>("sfx_club_hit");
			GameObject prefab3 = Cache.GetPrefab<GameObject>("vfx_blocked");
			GameObject prefab4 = Cache.GetPrefab<GameObject>("sfx_wood_blocked");
			GameObject prefab5 = Cache.GetPrefab<GameObject>("fx_block_camshake");
			GameObject prefab6 = Cache.GetPrefab<GameObject>("sfx_club_swing");
			EffectList val = new EffectList();
			val.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
			{
				new EffectData
				{
					m_prefab = prefab
				},
				new EffectData
				{
					m_prefab = prefab2
				}
			};
			hitShield = val;
			val = new EffectList();
			val.m_effectPrefabs = (EffectData[])(object)new EffectData[3]
			{
				new EffectData
				{
					m_prefab = prefab3
				},
				new EffectData
				{
					m_prefab = prefab4
				},
				new EffectData
				{
					m_prefab = prefab5
				}
			};
			blockShield = val;
			val = new EffectList();
			val.m_effectPrefabs = (EffectData[])(object)new EffectData[1]
			{
				new EffectData
				{
					m_prefab = prefab6
				}
			};
			startShield = val;
		}

		public static void AddLokisItems()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			CustomItem val = new CustomItem(WeedheimArmorMod.armoritems.LoadAsset<GameObject>("ArmorHempLegs"), true);
			CustomItem val2 = new CustomItem(WeedheimArmorMod.armoritems.LoadAsset<GameObject>("ArmorHempChest"), true);
			CustomItem val3 = new CustomItem(WeedheimArmorMod.armoritems.LoadAsset<GameObject>("ArmorHempCape"), true);
			CustomItem val4 = new CustomItem(WeedheimArmorMod.armoritems.LoadAsset<GameObject>("ArmorHempHelmet"), false);
			ItemManager.Instance.AddItem(val);
			ItemManager.Instance.AddItem(val2);
			ItemManager.Instance.AddItem(val3);
			ItemManager.Instance.AddItem(val4);
		}

		public static void AddBandedShield()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			GameObject val = WeedheimArmorMod.armoritems.LoadAsset<GameObject>("ArmorBandedSheild");
			ItemConfig val2 = new ItemConfig();
			val2.Amount = 1;
			val2.CraftingStation = CraftingStations.Forge;
			val2.MinStationLevel = 2;
			val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig
				{
					Item = "FineWood",
					Amount = 10,
					AmountPerLevel = 10
				},
				new RequirementConfig
				{
					Item = "Iron",
					Amount = 6,
					AmountPerLevel = 6
				}
			};
			CustomItem val3 = new CustomItem(val, true, val2);
			ItemDrop component = val.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_hitEffect = hitShield;
			component.m_itemData.m_shared.m_startEffect = startShield;
			component.m_itemData.m_shared.m_blockEffect = blockShield;
			ItemManager.Instance.AddItem(val3);
		}

		public static void AddTowerShield()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			GameObject val = WeedheimArmorMod.armoritems.LoadAsset<GameObject>("ArmorTowerSheild");
			ItemConfig val2 = new ItemConfig();
			val2.Amount = 1;
			val2.CraftingStation = CraftingStations.Forge;
			val2.MinStationLevel = 2;
			val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig
				{
					Item = "FineWood",
					Amount = 15,
					AmountPerLevel = 15
				},
				new RequirementConfig
				{
					Item = "Iron",
					Amount = 8,
					AmountPerLevel = 8
				}
			};
			CustomItem val3 = new CustomItem(val, true, val2);
			ItemDrop component = val.GetComponent<ItemDrop>();
			component.m_itemData.m_shared.m_hitEffect = hitShield;
			component.m_itemData.m_shared.m_startEffect = startShield;
			component.m_itemData.m_shared.m_blockEffect = blockShield;
			ItemManager.Instance.AddItem(val3);
		}
	}
	public class GamePatches
	{
		[HarmonyPatch(typeof(Character), "Jump")]
		public static class Character_Jump_Patch
		{
			public static bool Prefix(Character __instance)
			{
				if (__instance.IsPlayer())
				{
					IsJumping = true;
					IsDoubleJumping = false;
					FirstCallToIsOnGround = false;
				}
				return true;
			}

			public static void Postfix(Character __instance)
			{
				if (__instance.IsPlayer())
				{
					IsJumping = false;
					IsDoubleJumping = false;
				}
			}
		}

		[HarmonyPatch(typeof(Character), "IsOnGround")]
		public static class Character_IsOnGround_Patch
		{
			public static void Postfix(Character __instance, ref bool __result)
			{
				if (!FirstCallToIsOnGround && __instance.IsPlayer() && !__result && IsJumping && HasDoubleJumpCharge(__instance))
				{
					FirstCallToIsOnGround = true;
					__result = true;
					IsDoubleJumping = true;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "OnJump")]
		public static class Player_OnJump_Patch
		{
			public static void Postfix(Player __instance)
			{
				if (IsJumping && IsDoubleJumping)
				{
					UseDoubleJumpCharge((Character)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(Character), "ResetGroundContact")]
		public static class Character_ResetGroundContact_Patch
		{
			public static bool Prefix(Character __instance)
			{
				if (!__instance.IsPlayer())
				{
					return true;
				}
				GroundContactTracker.TryGetValue(__instance, out var value);
				if (__instance.m_groundContact && value != __instance.m_groundContact)
				{
					ResetDoubleJumpCharges(__instance);
				}
				GroundContactTracker[__instance] = __instance.m_groundContact;
				return true;
			}
		}

		[HarmonyPatch(typeof(Humanoid), "EquipItem")]
		public static class Humanoid_EquipItem_Patch
		{
			public static void Postfix(Humanoid __instance)
			{
				ResetDoubleJumpCharges((Character)(object)__instance);
			}
		}

		[HarmonyPatch(typeof(Humanoid), "UnequipItem")]
		public static class Humanoid_UnequipItem_Patch
		{
			public static void Postfix(Humanoid __instance)
			{
				ResetDoubleJumpCharges((Character)(object)__instance);
			}
		}

		[HarmonyPatch(typeof(Debug), "Log", new Type[] { typeof(object) })]
		public static class DebugLogPatch
		{
			private static bool Prefix(ref object message)
			{
				return !(message?.ToString() ?? string.Empty).Contains("PlatformUserID");
			}
		}

		public const string DoubleJumpChargeKey = "DoubleJump";

		public static bool IsJumping;

		public static bool IsDoubleJumping;

		public static bool FirstCallToIsOnGround;

		public static readonly Dictionary<Character, bool> GroundContactTracker = new Dictionary<Character, bool>();

		public static bool HasDoubleJumpCharge(Character character)
		{
			return character.m_nview.GetZDO().GetInt("DoubleJump", 0) > 0;
		}

		public static void UseDoubleJumpCharge(Character character)
		{
			int @int = character.m_nview.GetZDO().GetInt("DoubleJump", 0);
			character.m_nview.GetZDO().Set("DoubleJump", @int - 1);
		}

		public static void ResetDoubleJumpCharges(Character character)
		{
			if ((Object)(object)character == (Object)null || (Object)(object)character.m_nview == (Object)null || !character.m_nview.IsValid())
			{
				return;
			}
			Character obj = (character.IsPlayer() ? ((character is Player) ? character : null) : null);
			bool flag = false;
			if (!((Object)(object)obj != (Object)null))
			{
				return;
			}
			foreach (StatusEffect statusEffect in ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffects())
			{
				if (((Object)statusEffect).name.StartsWith("HempArmorStatusEffect"))
				{
					flag = true;
				}
			}
			if (flag && MainConfig.capeDoubleJump.Value)
			{
				character.m_nview.GetZDO().Set("DoubleJump", 1);
			}
			else
			{
				character.m_nview.GetZDO().Set("DoubleJump", 0);
			}
		}
	}
}
namespace WeedheimArmor.Updates
{
	internal class UpdateArmorSettings
	{
		public static void ArmorSettingsChanged()
		{
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = PrefabManager.Instance.GetPrefab("ArmorHempLegs");
			if ((Object)(object)prefab != (Object)null)
			{
				ItemDrop component = prefab.GetComponent<ItemDrop>();
				component.m_itemData.m_durability = MainConfig.legsDurability.Value;
				component.m_itemData.m_shared.m_maxDurability = MainConfig.legsMaxDurability.Value;
				component.m_itemData.m_shared.m_durabilityPerLevel = MainConfig.legsDurabilityPerLevel.Value;
				component.m_itemData.m_shared.m_armor = MainConfig.legsArmor.Value;
				component.m_itemData.m_shared.m_armorPerLevel = MainConfig.legsArmorPerLevel.Value;
				component.m_itemData.m_shared.m_eitrRegenModifier = MainConfig.legsEitrRegen.Value;
				component.m_itemData.m_shared.m_movementModifier = MainConfig.legsMovement.Value;
				component.m_itemData.m_shared.m_heatResistanceModifier = MainConfig.legsHeat.Value;
				component.m_itemData.m_shared.m_jumpStaminaModifier = MainConfig.legsJump.Value;
				component.m_itemData.m_shared.m_runStaminaModifier = MainConfig.legsRun.Value;
			}
			GameObject prefab2 = PrefabManager.Instance.GetPrefab("ArmorHempChest");
			if ((Object)(object)prefab2 != (Object)null)
			{
				ItemDrop component2 = prefab2.GetComponent<ItemDrop>();
				component2.m_itemData.m_durability = MainConfig.chestDurability.Value;
				component2.m_itemData.m_shared.m_maxDurability = MainConfig.chestMaxDurability.Value;
				component2.m_itemData.m_shared.m_durabilityPerLevel = MainConfig.chestDurabilityPerLevel.Value;
				component2.m_itemData.m_shared.m_armor = MainConfig.chestArmor.Value;
				component2.m_itemData.m_shared.m_armorPerLevel = MainConfig.chestArmorPerLevel.Value;
				component2.m_itemData.m_shared.m_eitrRegenModifier = MainConfig.chestEitrRegen.Value;
				component2.m_itemData.m_shared.m_movementModifier = MainConfig.chestMovement.Value;
				component2.m_itemData.m_shared.m_heatResistanceModifier = MainConfig.chestHeat.Value;
			}
			GameObject prefab3 = PrefabManager.Instance.GetPrefab("ArmorHempHelmet");
			if ((Object)(object)prefab3 != (Object)null)
			{
				ItemDrop component3 = prefab3.GetComponent<ItemDrop>();
				component3.m_itemData.m_durability = MainConfig.helmetDurability.Value;
				component3.m_itemData.m_shared.m_maxDurability = MainConfig.helmetMaxDurability.Value;
				component3.m_itemData.m_shared.m_durabilityPerLevel = MainConfig.helmetDurabilityPerLevel.Value;
				component3.m_itemData.m_shared.m_armor = MainConfig.helmetArmor.Value;
				component3.m_itemData.m_shared.m_armorPerLevel = MainConfig.helmetArmorPerLevel.Value;
				component3.m_itemData.m_shared.m_eitrRegenModifier = MainConfig.helmetEitrRegen.Value;
				component3.m_itemData.m_shared.m_heatResistanceModifier = MainConfig.helmetHeat.Value;
			}
			GameObject prefab4 = PrefabManager.Instance.GetPrefab("ArmorHempCape");
			if ((Object)(object)prefab4 != (Object)null)
			{
				ItemDrop component4 = prefab4.GetComponent<ItemDrop>();
				component4.m_itemData.m_durability = MainConfig.capeDurability.Value;
				component4.m_itemData.m_shared.m_maxDurability = MainConfig.capeMaxDurability.Value;
				component4.m_itemData.m_shared.m_durabilityPerLevel = MainConfig.capeDurabilityPerLevel.Value;
				component4.m_itemData.m_shared.m_armor = MainConfig.capeArmor.Value;
				component4.m_itemData.m_shared.m_armorPerLevel = MainConfig.capeArmorPerLevel.Value;
				component4.m_itemData.m_shared.m_runStaminaModifier = MainConfig.capeRun.Value;
			}
			GameObject prefab5 = PrefabManager.Instance.GetPrefab("ArmorBandedSheild");
			if ((Object)(object)prefab5 != (Object)null)
			{
				ItemDrop component5 = prefab5.GetComponent<ItemDrop>();
				component5.m_itemData.m_durability = MainConfig.bandedDurability.Value;
				component5.m_itemData.m_shared.m_maxDurability = MainConfig.bandedMaxDurability.Value;
				component5.m_itemData.m_shared.m_durabilityPerLevel = MainConfig.bandedDurabilityPerLevel.Value;
				component5.m_itemData.m_shared.m_armor = MainConfig.bandedArmor.Value;
				component5.m_itemData.m_shared.m_armorPerLevel = MainConfig.bandedArmorPerLevel.Value;
				component5.m_itemData.m_shared.m_blockPower = MainConfig.bandedBlockPower.Value;
				component5.m_itemData.m_shared.m_blockPowerPerLevel = MainConfig.bandedPowerPerLevel.Value;
				component5.m_itemData.m_shared.m_deflectionForce = MainConfig.bandedDeflectionForce.Value;
				component5.m_itemData.m_shared.m_deflectionForcePerLevel = MainConfig.bandedForcePerLevel.Value;
				component5.m_itemData.m_shared.m_timedBlockBonus = MainConfig.bandedBlockedBonus.Value;
				component5.m_itemData.m_shared.m_movementModifier = MainConfig.bandedMovement.Value;
			}
			GameObject prefab6 = PrefabManager.Instance.GetPrefab("ArmorTowerSheild");
			if ((Object)(object)prefab6 != (Object)null)
			{
				ItemDrop component6 = prefab6.GetComponent<ItemDrop>();
				component6.m_itemData.m_durability = MainConfig.towerDurability.Value;
				component6.m_itemData.m_shared.m_maxDurability = MainConfig.towerMaxDurability.Value;
				component6.m_itemData.m_shared.m_durabilityPerLevel = MainConfig.towerDurabilityPerLevel.Value;
				component6.m_itemData.m_shared.m_armor = MainConfig.towerArmor.Value;
				component6.m_itemData.m_shared.m_armorPerLevel = MainConfig.towerArmorPerLevel.Value;
				component6.m_itemData.m_shared.m_blockPower = MainConfig.towerBlockPower.Value;
				component6.m_itemData.m_shared.m_blockPowerPerLevel = MainConfig.towerPowerPerLevel.Value;
				component6.m_itemData.m_shared.m_deflectionForce = MainConfig.towerDeflectionForce.Value;
				component6.m_itemData.m_shared.m_deflectionForcePerLevel = MainConfig.towerForcePerLevel.Value;
				component6.m_itemData.m_shared.m_timedBlockBonus = MainConfig.towerBlockedBonus.Value;
				component6.m_itemData.m_shared.m_movementModifier = MainConfig.towerMovement.Value;
			}
			SE_Stats prefab7 = Cache.GetPrefab<SE_Stats>("WH_Hemp_Armor");
			if ((Object)(object)prefab7 != (Object)null)
			{
				prefab7.m_runStaminaDrainModifier = MainConfig.armorStaminaRunVal.Value;
				prefab7.m_jumpStaminaUseModifier = MainConfig.armorStaminaJumpVal.Value;
				prefab7.m_attackStaminaUseModifier = MainConfig.armorStaminaAttackVal.Value;
				prefab7.m_healthRegenMultiplier = MainConfig.armorHealthRegenVal.Value;
				prefab7.m_staminaRegenMultiplier = MainConfig.armorStaminaRegenVal.Value;
				prefab7.m_eitrRegenMultiplier = MainConfig.armorEitrRegenVal.Value;
			}
			SE_Stats prefab8 = Cache.GetPrefab<SE_Stats>("WH_Cape_Effect");
			if ((Object)(object)prefab8 != (Object)null)
			{
				prefab8.m_speedModifier = MainConfig.capeSpeedVal.Value;
				prefab8.m_jumpModifier = new Vector3(0f, MainConfig.capeJumpVal.Value, 0f);
				prefab8.m_maxMaxFallSpeed = MainConfig.capeFallSpeed.Value;
				prefab8.m_fallDamageModifier = MainConfig.capeFallDamage.Value;
				prefab8.m_windMovementModifier = MainConfig.capeWindMovement.Value;
				prefab8.m_windRunStaminaModifier = MainConfig.capeWindStamina.Value;
			}
		}
	}
}
namespace WeedheimArmor.Effects
{
	internal class WH_StatusEffects
	{
		public static CustomStatusEffect armorStatusEffect;

		public static CustomStatusEffect capeStatusEffect;

		public static void LoadWeedheimEffects()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			SE_Stats obj = WeedheimArmorMod.armoritems.LoadAsset<SE_Stats>("WH_Hemp_Armor");
			((Object)obj).name = "HempArmorStatusEffect";
			obj.m_runStaminaDrainModifier = MainConfig.armorStaminaRunVal.Value;
			obj.m_jumpStaminaUseModifier = MainConfig.armorStaminaJumpVal.Value;
			obj.m_attackStaminaUseModifier = MainConfig.armorStaminaAttackVal.Value;
			obj.m_healthRegenMultiplier = MainConfig.armorHealthRegenVal.Value;
			obj.m_staminaRegenMultiplier = MainConfig.armorStaminaRegenVal.Value;
			obj.m_eitrRegenMultiplier = MainConfig.armorEitrRegenVal.Value;
			armorStatusEffect = new CustomStatusEffect((StatusEffect)(object)obj, false);
			ItemManager.Instance.AddStatusEffect(armorStatusEffect);
			SE_Stats obj2 = WeedheimArmorMod.armoritems.LoadAsset<SE_Stats>("WH_Cape_Effect");
			((Object)obj2).name = "HempCapeStatusEffect";
			obj2.m_speedModifier = MainConfig.capeSpeedVal.Value;
			obj2.m_jumpModifier = new Vector3(0f, MainConfig.capeJumpVal.Value, 0f);
			obj2.m_maxMaxFallSpeed = MainConfig.capeFallSpeed.Value;
			obj2.m_fallDamageModifier = MainConfig.capeFallDamage.Value;
			obj2.m_windMovementModifier = MainConfig.capeWindMovement.Value;
			obj2.m_windRunStaminaModifier = MainConfig.capeWindStamina.Value;
			capeStatusEffect = new CustomStatusEffect((StatusEffect)(object)obj2, false);
			ItemManager.Instance.AddStatusEffect(capeStatusEffect);
		}
	}
}