Decompiled source of Ravenwood Currency v1.0.0

plugins/RavenwoodCurrency/RavenwoodCurrency.dll

Decompiled 7 hours ago
using System;
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.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ravenwood Currency")]
[assembly: AssemblyDescription("Ravenwood material-to-coin and coin exchange system for Valheim")]
[assembly: AssemblyCompany("Ravenwood")]
[assembly: AssemblyProduct("Ravenwood Currency")]
[assembly: ComVisible(false)]
[assembly: Guid("b581d77a-5c1c-48c7-9fa8-3a4748d9b802")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RavenwoodCurrency;

internal static class BossDropManager
{
	private sealed class BossDropRule
	{
		internal string[] BossPrefabs { get; }

		internal string CoinPrefab { get; }

		internal ConfigEntry<float> ChanceConfig { get; }

		internal int AmountMin { get; }

		internal int AmountMax { get; }

		internal ConfigEntry<int> AmountMinConfig { get; }

		internal ConfigEntry<int> AmountMaxConfig { get; }

		internal bool IsBossDrop { get; }

		internal BossDropRule(string[] bossPrefabs, string coinPrefab, ConfigEntry<float> chance)
		{
			BossPrefabs = bossPrefabs;
			CoinPrefab = coinPrefab;
			ChanceConfig = chance;
			AmountMin = 1;
			AmountMax = 1;
			IsBossDrop = true;
		}

		internal BossDropRule(string[] bossPrefabs, string coinPrefab, ConfigEntry<float> chance, int amountMin, int amountMax, bool isBossDrop)
		{
			BossPrefabs = bossPrefabs;
			CoinPrefab = coinPrefab;
			ChanceConfig = chance;
			AmountMin = amountMin;
			AmountMax = amountMax;
			IsBossDrop = isBossDrop;
		}

		internal BossDropRule(string[] bossPrefabs, string coinPrefab, ConfigEntry<float> chance, ConfigEntry<int> amountMin, ConfigEntry<int> amountMax, bool isBossDrop)
		{
			BossPrefabs = bossPrefabs;
			CoinPrefab = coinPrefab;
			ChanceConfig = chance;
			AmountMinConfig = amountMin;
			AmountMaxConfig = amountMax;
			IsBossDrop = isBossDrop;
		}

		internal float GetChance()
		{
			return ChanceConfig.Value;
		}

		internal int GetAmountMin()
		{
			return (AmountMinConfig != null) ? AmountMinConfig.Value : AmountMin;
		}

		internal int GetAmountMax()
		{
			return (AmountMaxConfig != null) ? AmountMaxConfig.Value : AmountMax;
		}
	}

	internal static void ApplyToLoadedBossPrefabs()
	{
		if ((Object)(object)ZNetScene.instance == (Object)null)
		{
			return;
		}
		foreach (BossDropRule rule in GetRules())
		{
			string[] bossPrefabs = rule.BossPrefabs;
			foreach (string text in bossPrefabs)
			{
				GameObject prefab = ZNetScene.instance.GetPrefab(text);
				CharacterDrop val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<CharacterDrop>() : null);
				if ((Object)(object)val != (Object)null)
				{
					Apply(val);
				}
			}
		}
	}

	internal static void Apply(CharacterDrop characterDrop)
	{
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: 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_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Expected O, but got Unknown
		if ((Object)(object)characterDrop == (Object)null)
		{
			return;
		}
		string characterName = NormalizeName(((Object)((Component)characterDrop).gameObject).name);
		foreach (BossDropRule rule in GetRules())
		{
			bool flag = Array.Exists(rule.BossPrefabs, (string bossPrefab) => bossPrefab.Equals(characterName, StringComparison.OrdinalIgnoreCase));
			bool flag2 = (rule.IsBossDrop ? CurrencyConfig.EnableBossDrops.Value : CurrencyConfig.EnableMonsterDrops.Value);
			float chance = rule.GetChance();
			if (flag && flag2 && !(chance <= 0f))
			{
				GameObject coinPrefab = CurrencyRegistrar.GetCoinPrefab(rule.CoinPrefab);
				if (!((Object)(object)coinPrefab == (Object)null) && !characterDrop.m_drops.Exists((Drop drop) => (Object)(object)drop.m_prefab != (Object)null && ((Object)drop.m_prefab).name == ((Object)coinPrefab).name))
				{
					characterDrop.m_drops.Add(new Drop
					{
						m_prefab = coinPrefab,
						m_amountMin = rule.GetAmountMin(),
						m_amountMax = rule.GetAmountMax(),
						m_chance = Mathf.Clamp01(chance / 100f),
						m_onePerPlayer = false,
						m_levelMultiplier = false
					});
				}
			}
		}
	}

	private static IEnumerable<BossDropRule> GetRules()
	{
		string deepNorthName = (string.IsNullOrWhiteSpace(CurrencyConfig.DeepNorthBossPrefab.Value) ? "DeepNorthBoss" : CurrencyConfig.DeepNorthBossPrefab.Value.Trim());
		yield return new BossDropRule(new string[1] { "Eikthyr" }, "RWc_Lion", CurrencyConfig.EikthyrGoldChance);
		yield return new BossDropRule(new string[1] { "gd_king" }, "RWc_Lion", CurrencyConfig.ElderGoldChance);
		yield return new BossDropRule(new string[1] { "Bonemass" }, "RWc_Lion", CurrencyConfig.BonemassGoldChance);
		yield return new BossDropRule(new string[1] { "Dragon" }, "RWc_Lion", CurrencyConfig.ModerGoldChance);
		yield return new BossDropRule(new string[1] { "GoblinKing" }, "RWc_Lion", CurrencyConfig.YagluthGoldChance);
		yield return new BossDropRule(new string[1] { "SeekerQueen" }, "RWc_Lion", CurrencyConfig.QueenGoldChance);
		yield return new BossDropRule(new string[1] { "Fader" }, "RWc_Lion", CurrencyConfig.FaderGoldChance);
		yield return new BossDropRule(new string[1] { deepNorthName }, "RWc_Lion", CurrencyConfig.DeepNorthGoldChance);
		yield return new BossDropRule(new string[1] { "Dragon" }, "RWc_Raven", CurrencyConfig.ModerMithrilChance);
		yield return new BossDropRule(new string[1] { "Fader" }, "RWc_Raven", CurrencyConfig.FaderMithrilChance);
		yield return new BossDropRule(new string[1] { "Eikthyr" }, "RWc_Deer", CurrencyConfig.EikthyrCopperChance, CurrencyConfig.EikthyrCopperAmountMin, CurrencyConfig.EikthyrCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "gd_king" }, "RWc_Deer", CurrencyConfig.ElderCopperChance, CurrencyConfig.ElderCopperAmountMin, CurrencyConfig.ElderCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Bonemass" }, "RWc_Deer", CurrencyConfig.BonemassCopperChance, CurrencyConfig.BonemassCopperAmountMin, CurrencyConfig.BonemassCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Dragon" }, "RWc_Deer", CurrencyConfig.ModerCopperChance, CurrencyConfig.ModerCopperAmountMin, CurrencyConfig.ModerCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "GoblinKing" }, "RWc_Deer", CurrencyConfig.YagluthCopperChance, CurrencyConfig.YagluthCopperAmountMin, CurrencyConfig.YagluthCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "SeekerQueen" }, "RWc_Deer", CurrencyConfig.QueenCopperChance, CurrencyConfig.QueenCopperAmountMin, CurrencyConfig.QueenCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Fader" }, "RWc_Deer", CurrencyConfig.FaderCopperChance, CurrencyConfig.FaderCopperAmountMin, CurrencyConfig.FaderCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { deepNorthName }, "RWc_Deer", CurrencyConfig.DeepNorthCopperChance, CurrencyConfig.DeepNorthCopperAmountMin, CurrencyConfig.DeepNorthCopperAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "gd_king" }, "RWc_Bear", CurrencyConfig.ElderBronzeChance, CurrencyConfig.ElderBronzeAmountMin, CurrencyConfig.ElderBronzeAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Bonemass" }, "RWc_Bear", CurrencyConfig.BonemassBronzeChance, CurrencyConfig.BonemassBronzeAmountMin, CurrencyConfig.BonemassBronzeAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Dragon" }, "RWc_Bear", CurrencyConfig.ModerBronzeChance, CurrencyConfig.ModerBronzeAmountMin, CurrencyConfig.ModerBronzeAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "GoblinKing" }, "RWc_Bear", CurrencyConfig.YagluthBronzeChance, CurrencyConfig.YagluthBronzeAmountMin, CurrencyConfig.YagluthBronzeAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "SeekerQueen" }, "RWc_Bear", CurrencyConfig.QueenBronzeChance, CurrencyConfig.QueenBronzeAmountMin, CurrencyConfig.QueenBronzeAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Fader" }, "RWc_Bear", CurrencyConfig.FaderBronzeChance, CurrencyConfig.FaderBronzeAmountMin, CurrencyConfig.FaderBronzeAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { deepNorthName }, "RWc_Bear", CurrencyConfig.DeepNorthBronzeChance, CurrencyConfig.DeepNorthBronzeAmountMin, CurrencyConfig.DeepNorthBronzeAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Bonemass" }, "RWc_Snake", CurrencyConfig.BonemassIronChance, CurrencyConfig.BonemassIronAmountMin, CurrencyConfig.BonemassIronAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Dragon" }, "RWc_Snake", CurrencyConfig.ModerIronChance, CurrencyConfig.ModerIronAmountMin, CurrencyConfig.ModerIronAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "GoblinKing" }, "RWc_Snake", CurrencyConfig.YagluthIronChance, CurrencyConfig.YagluthIronAmountMin, CurrencyConfig.YagluthIronAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "SeekerQueen" }, "RWc_Snake", CurrencyConfig.QueenIronChance, CurrencyConfig.QueenIronAmountMin, CurrencyConfig.QueenIronAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Fader" }, "RWc_Snake", CurrencyConfig.FaderIronChance, CurrencyConfig.FaderIronAmountMin, CurrencyConfig.FaderIronAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { deepNorthName }, "RWc_Snake", CurrencyConfig.DeepNorthIronChance, CurrencyConfig.DeepNorthIronAmountMin, CurrencyConfig.DeepNorthIronAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Dragon" }, "RWc_Wolf", CurrencyConfig.ModerSilverChance, CurrencyConfig.ModerSilverAmountMin, CurrencyConfig.ModerSilverAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "GoblinKing" }, "RWc_Wolf", CurrencyConfig.YagluthSilverChance, CurrencyConfig.YagluthSilverAmountMin, CurrencyConfig.YagluthSilverAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "SeekerQueen" }, "RWc_Wolf", CurrencyConfig.QueenSilverChance, CurrencyConfig.QueenSilverAmountMin, CurrencyConfig.QueenSilverAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Fader" }, "RWc_Wolf", CurrencyConfig.FaderSilverChance, CurrencyConfig.FaderSilverAmountMin, CurrencyConfig.FaderSilverAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { deepNorthName }, "RWc_Wolf", CurrencyConfig.DeepNorthSilverChance, CurrencyConfig.DeepNorthSilverAmountMin, CurrencyConfig.DeepNorthSilverAmountMax, isBossDrop: true);
		yield return new BossDropRule(new string[1] { "Greyling" }, "RWc_Deer", CurrencyConfig.GreylingCopperChance, CurrencyConfig.GreylingCopperAmountMin, CurrencyConfig.GreylingCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Greydwarf" }, "RWc_Deer", CurrencyConfig.GreydwarfCopperChance, CurrencyConfig.GreydwarfCopperAmountMin, CurrencyConfig.GreydwarfCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Greydwarf_Shaman" }, "RWc_Deer", CurrencyConfig.GreydwarfShamanCopperChance, CurrencyConfig.GreydwarfShamanCopperAmountMin, CurrencyConfig.GreydwarfShamanCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Greydwarf_Elite" }, "RWc_Deer", CurrencyConfig.GreydwarfEliteCopperChance, CurrencyConfig.GreydwarfEliteCopperAmountMin, CurrencyConfig.GreydwarfEliteCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Skeleton" }, "RWc_Deer", CurrencyConfig.SkeletonCopperChance, CurrencyConfig.SkeletonCopperAmountMin, CurrencyConfig.SkeletonCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Troll" }, "RWc_Deer", CurrencyConfig.TrollCopperChance, CurrencyConfig.TrollCopperAmountMin, CurrencyConfig.TrollCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Draugr" }, "RWc_Deer", CurrencyConfig.DraugrCopperChance, CurrencyConfig.DraugrCopperAmountMin, CurrencyConfig.DraugrCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Draugr_Elite" }, "RWc_Deer", CurrencyConfig.DraugrEliteCopperChance, CurrencyConfig.DraugrEliteCopperAmountMin, CurrencyConfig.DraugrEliteCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Goblin" }, "RWc_Deer", CurrencyConfig.GoblinCopperChance, CurrencyConfig.GoblinCopperAmountMin, CurrencyConfig.GoblinCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "GoblinShaman" }, "RWc_Deer", CurrencyConfig.GoblinShamanCopperChance, CurrencyConfig.GoblinShamanCopperAmountMin, CurrencyConfig.GoblinShamanCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "GoblinBrute" }, "RWc_Deer", CurrencyConfig.GoblinBruteCopperChance, CurrencyConfig.GoblinBruteCopperAmountMin, CurrencyConfig.GoblinBruteCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[6] { "Dverger", "DvergerAshlands", "DvergerMage", "DvergerMageFire", "DvergerMageIce", "DvergerMageSupport" }, "RWc_Deer", CurrencyConfig.DvergerCopperChance, CurrencyConfig.DvergerCopperAmountMin, CurrencyConfig.DvergerCopperAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Greydwarf" }, "RWc_Bear", CurrencyConfig.GreydwarfBronzeChance, CurrencyConfig.GreydwarfBronzeAmountMin, CurrencyConfig.GreydwarfBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Greydwarf_Shaman" }, "RWc_Bear", CurrencyConfig.GreydwarfShamanBronzeChance, CurrencyConfig.GreydwarfShamanBronzeAmountMin, CurrencyConfig.GreydwarfShamanBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Greydwarf_Elite" }, "RWc_Bear", CurrencyConfig.GreydwarfEliteBronzeChance, CurrencyConfig.GreydwarfEliteBronzeAmountMin, CurrencyConfig.GreydwarfEliteBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Troll" }, "RWc_Bear", CurrencyConfig.TrollBronzeChance, CurrencyConfig.TrollBronzeAmountMin, CurrencyConfig.TrollBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Skeleton" }, "RWc_Bear", CurrencyConfig.SkeletonBronzeChance, CurrencyConfig.SkeletonBronzeAmountMin, CurrencyConfig.SkeletonBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Skeleton_Poison" }, "RWc_Bear", CurrencyConfig.RancidRemainsBronzeChance, CurrencyConfig.RancidRemainsBronzeAmountMin, CurrencyConfig.RancidRemainsBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Draugr" }, "RWc_Snake", CurrencyConfig.DraugrIronChance, CurrencyConfig.DraugrIronAmountMin, CurrencyConfig.DraugrIronAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Draugr_Elite" }, "RWc_Snake", CurrencyConfig.DraugrEliteIronChance, CurrencyConfig.DraugrEliteIronAmountMin, CurrencyConfig.DraugrEliteIronAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Wraith" }, "RWc_Snake", CurrencyConfig.WraithIronChance, CurrencyConfig.WraithIronAmountMin, CurrencyConfig.WraithIronAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Surtling" }, "RWc_Snake", CurrencyConfig.SurtlingIronChance, CurrencyConfig.SurtlingIronAmountMin, CurrencyConfig.SurtlingIronAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Ulv" }, "RWc_Wolf", CurrencyConfig.UlvSilverChance, CurrencyConfig.UlvSilverAmountMin, CurrencyConfig.UlvSilverAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Fenring_Cultist" }, "RWc_Wolf", CurrencyConfig.CultistSilverChance, CurrencyConfig.CultistSilverAmountMin, CurrencyConfig.CultistSilverAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Fenring" }, "RWc_Wolf", CurrencyConfig.FenringSilverChance, CurrencyConfig.FenringSilverAmountMin, CurrencyConfig.FenringSilverAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "StoneGolem" }, "RWc_Wolf", CurrencyConfig.StoneGolemSilverChance, CurrencyConfig.StoneGolemSilverAmountMin, CurrencyConfig.StoneGolemSilverAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Wraith" }, "RWc_Wolf", CurrencyConfig.WraithSilverChance, CurrencyConfig.WraithSilverAmountMin, CurrencyConfig.WraithSilverAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[6] { "Dverger", "DvergerAshlands", "DvergerMage", "DvergerMageFire", "DvergerMageIce", "DvergerMageSupport" }, "RWc_Wolf", CurrencyConfig.DvergerSilverChance, CurrencyConfig.DvergerSilverAmountMin, CurrencyConfig.DvergerSilverAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Goblin" }, "RWc_Snake", CurrencyConfig.GoblinIronChance, CurrencyConfig.GoblinIronAmountMin, CurrencyConfig.GoblinIronAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "Goblin" }, "RWc_Bear", CurrencyConfig.GoblinBronzeChance, CurrencyConfig.GoblinBronzeAmountMin, CurrencyConfig.GoblinBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "GoblinShaman" }, "RWc_Snake", CurrencyConfig.GoblinShamanIronChance, CurrencyConfig.GoblinShamanIronAmountMin, CurrencyConfig.GoblinShamanIronAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "GoblinShaman" }, "RWc_Bear", CurrencyConfig.GoblinShamanBronzeChance, CurrencyConfig.GoblinShamanBronzeAmountMin, CurrencyConfig.GoblinShamanBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "GoblinBrute" }, "RWc_Snake", CurrencyConfig.GoblinBruteIronChance, CurrencyConfig.GoblinBruteIronAmountMin, CurrencyConfig.GoblinBruteIronAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "GoblinBrute" }, "RWc_Bear", CurrencyConfig.GoblinBruteBronzeChance, CurrencyConfig.GoblinBruteBronzeAmountMin, CurrencyConfig.GoblinBruteBronzeAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "FallenValkyrie" }, "RWc_Lion", CurrencyConfig.ValkyrieGoldChance, 1, 1, isBossDrop: false);
		yield return new BossDropRule(new string[1] { "FallenValkyrie" }, "RWc_Wolf", CurrencyConfig.ValkyrieSilverChance, CurrencyConfig.ValkyrieSilverAmountMin, CurrencyConfig.ValkyrieSilverAmountMax, isBossDrop: false);
		yield return new BossDropRule(new string[8] { "Charred_Archer", "Charred_Archer_Fader", "Charred_Mage", "Charred_Melee", "Charred_Melee_Dyrnwyn", "Charred_Melee_Fader", "Charred_Twitcher", "Charred_Twitcher_Summoned" }, "RWc_Snake", CurrencyConfig.CharredIronChance, CurrencyConfig.CharredIronAmountMin, CurrencyConfig.CharredIronAmountMax, isBossDrop: false);
	}

	private static string NormalizeName(string value)
	{
		return (value ?? string.Empty).Replace("(Clone)", string.Empty).Trim();
	}
}
[HarmonyPatch(typeof(CharacterDrop), "Start")]
internal static class CharacterDropStartPatch
{
	private static void Postfix(CharacterDrop __instance)
	{
		BossDropManager.Apply(__instance);
	}
}
internal static class CurrencyChestSetup
{
	private const string ExchangeBoxName = "exchange_box";

	private const string ExchangePressName = "exchange_press";

	private const string LidPivotName = "LidPivot";

	private const float OpenAngleX = -20f;

	internal static void ConfigureBundlePrefabs(AssetBundle bundle)
	{
		if (!((Object)(object)bundle == (Object)null))
		{
			ConfigureTablePrefab(bundle.LoadAsset<GameObject>("RWc_Table"));
			ConfigureChestPrefab(bundle.LoadAsset<GameObject>("RWc_Chest"));
		}
	}

	internal static void ConfigureRegisteredPrefabs()
	{
		ConfigureTablePrefab(PrefabManager.Instance.GetPrefab("RWc_Table"));
		ConfigureChestPrefab(PrefabManager.Instance.GetPrefab("RWc_Chest"));
	}

	private static void ConfigureTablePrefab(GameObject table)
	{
		if ((Object)(object)table == (Object)null)
		{
			return;
		}
		Transform val = PrefabRuntimeUtility.FindChildRecursive(table.transform, "exchange_box");
		Transform val2 = PrefabRuntimeUtility.FindChildRecursive(table.transform, "exchange_press");
		if ((Object)(object)val2 == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)"RWc_Table is missing required child 'exchange_press'.");
		}
		else
		{
			MaterialExchangeInteract[] componentsInChildren = table.GetComponentsInChildren<MaterialExchangeInteract>(true);
			foreach (MaterialExchangeInteract materialExchangeInteract in componentsInChildren)
			{
				if ((Object)(object)((Component)materialExchangeInteract).transform != (Object)(object)val2)
				{
					Object.DestroyImmediate((Object)(object)materialExchangeInteract);
				}
			}
			PrefabRuntimeUtility.EnsureCollider(((Component)val2).gameObject);
			if ((Object)(object)((Component)val2).GetComponent<MaterialExchangeInteract>() == (Object)null)
			{
				((Component)val2).gameObject.AddComponent<MaterialExchangeInteract>();
			}
		}
		Container container = table.GetComponent<Container>() ?? table.AddComponent<Container>();
		ConfigureContainer(container);
		if ((Object)(object)val == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)"RWc_Table is missing required child 'exchange_box'.");
			return;
		}
		PrefabRuntimeUtility.EnsureCollider(((Component)val).gameObject);
		TableChestInteract tableChestInteract = ((Component)val).GetComponent<TableChestInteract>() ?? ((Component)val).gameObject.AddComponent<TableChestInteract>();
		tableChestInteract.Configure(container);
		ConfigureLidAnimation(((Component)val).gameObject, container);
	}

	private static void ConfigureChestPrefab(GameObject chest)
	{
		if (!((Object)(object)chest == (Object)null))
		{
			Container container = chest.GetComponent<Container>() ?? chest.AddComponent<Container>();
			ConfigureContainer(container);
			ConfigureLidAnimation(chest, container);
		}
	}

	private static void ConfigureContainer(Container container)
	{
		container.m_name = "Ravenwood Currency Chest";
		container.m_width = CurrencyConfig.ChestWidth.Value;
		container.m_height = CurrencyConfig.ChestHeight.Value;
	}

	private static void ConfigureLidAnimation(GameObject animationRoot, Container container)
	{
		bool flag = false;
		Transform[] componentsInChildren = animationRoot.GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name.Equals("LidPivot", StringComparison.Ordinal))
			{
				ChestLidAnimation chestLidAnimation = ((Component)val).GetComponent<ChestLidAnimation>() ?? ((Component)val).gameObject.AddComponent<ChestLidAnimation>();
				chestLidAnimation.Configure(container, val, -20f);
				flag = true;
			}
		}
		if (!flag)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)(((Object)animationRoot).name + " is missing required child 'LidPivot'."));
		}
	}
}
internal sealed class TableChestInteract : MonoBehaviour, Hoverable, Interactable
{
	[SerializeField]
	private Container _container;

	internal void Configure(Container container)
	{
		_container = container;
	}

	public string GetHoverName()
	{
		Container val = ResolveContainer();
		return ((Object)(object)val != (Object)null) ? val.GetHoverName() : "Ravenwood Currency Chest";
	}

	public string GetHoverText()
	{
		Container val = ResolveContainer();
		return ((Object)(object)val != (Object)null) ? val.GetHoverText() : "Ravenwood Currency Chest\n[<color=yellow><b>E</b></color>] Open";
	}

	public bool Interact(Humanoid user, bool hold, bool alt)
	{
		Container val = ResolveContainer();
		return (Object)(object)val != (Object)null && val.Interact(user, hold, alt);
	}

	public bool UseItem(Humanoid user, ItemData item)
	{
		Container val = ResolveContainer();
		return (Object)(object)val != (Object)null && val.UseItem(user, item);
	}

	private Container ResolveContainer()
	{
		if ((Object)(object)_container == (Object)null)
		{
			_container = ((Component)this).GetComponentInParent<Container>();
		}
		return _container;
	}
}
internal sealed class ChestLidAnimation : MonoBehaviour
{
	private const float RotationSpeed = 80f;

	private const string OpenSoundPrefab = "sfx_chest_open";

	private const string CloseSoundPrefab = "sfx_chest_close";

	private static readonly MethodInfo IsInUseMethod = typeof(Container).GetMethod("IsInUse", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);

	private static readonly FieldInfo InUseField = typeof(Container).GetField("m_inUse", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	[SerializeField]
	private Container _container;

	[SerializeField]
	private Transform _lidPivot;

	[SerializeField]
	private Vector3 _closedEuler;

	[SerializeField]
	private Vector3 _openEuler;

	private bool _lastOpen;

	private bool _stateInitialized;

	internal void Configure(Container container, Transform lidPivot, float openAngleX)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		_container = container;
		_lidPivot = lidPivot;
		if (!((Object)(object)_lidPivot == (Object)null))
		{
			_closedEuler = _lidPivot.localEulerAngles;
			_closedEuler.x = 0f;
			_openEuler = _closedEuler;
			_openEuler.x = openAngleX;
			_lidPivot.localRotation = Quaternion.Euler(_closedEuler);
		}
	}

	private void Start()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		bool flag = (_lastOpen = ReadOpenState());
		_stateInitialized = true;
		if ((Object)(object)_lidPivot != (Object)null)
		{
			_lidPivot.localRotation = Quaternion.Euler(flag ? _openEuler : _closedEuler);
		}
	}

	private void Update()
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_009f: Unknown result type (might be due to invalid IL or missing references)
		bool flag = ReadOpenState();
		if (!_stateInitialized)
		{
			_lastOpen = flag;
			_stateInitialized = true;
		}
		else if (flag != _lastOpen)
		{
			_lastOpen = flag;
			PlayChestSound(flag ? "sfx_chest_open" : "sfx_chest_close");
		}
		if (!((Object)(object)_lidPivot == (Object)null))
		{
			Quaternion val = Quaternion.Euler(flag ? _openEuler : _closedEuler);
			_lidPivot.localRotation = Quaternion.RotateTowards(_lidPivot.localRotation, val, 80f * Time.deltaTime);
		}
	}

	private bool ReadOpenState()
	{
		if ((Object)(object)_container == (Object)null)
		{
			_container = ((Component)this).GetComponentInParent<Container>();
		}
		if ((Object)(object)_container == (Object)null)
		{
			return false;
		}
		try
		{
			if (IsInUseMethod != null && IsInUseMethod.ReturnType == typeof(bool))
			{
				return (bool)IsInUseMethod.Invoke(_container, null);
			}
			if (InUseField != null && InUseField.FieldType == typeof(bool))
			{
				return (bool)InUseField.GetValue(_container);
			}
		}
		catch
		{
			return false;
		}
		return false;
	}

	private void PlayChestSound(string prefabName)
	{
		//IL_004c: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(prefabName) : null);
		if (!((Object)(object)val == (Object)null))
		{
			Vector3 val2 = (((Object)(object)_lidPivot != (Object)null) ? _lidPivot.position : ((Component)this).transform.position);
			Object.Instantiate<GameObject>(val, val2, Quaternion.identity);
		}
	}
}
internal static class CurrencyConfig
{
	internal static ConfigEntry<bool> AllowTraderSales { get; private set; }

	internal static ConfigEntry<bool> EnableBossDrops { get; private set; }

	internal static ConfigEntry<bool> EnableMonsterDrops { get; private set; }

	internal static ConfigEntry<string> TableBuildCost { get; private set; }

	internal static ConfigEntry<string> ChestBuildCost { get; private set; }

	internal static ConfigEntry<int> ChestWidth { get; private set; }

	internal static ConfigEntry<int> ChestHeight { get; private set; }

	internal static ConfigEntry<string> DeepNorthBossPrefab { get; private set; }

	internal static ConfigEntry<float> EikthyrGoldChance { get; private set; }

	internal static ConfigEntry<float> ElderGoldChance { get; private set; }

	internal static ConfigEntry<float> BonemassGoldChance { get; private set; }

	internal static ConfigEntry<float> ModerGoldChance { get; private set; }

	internal static ConfigEntry<float> YagluthGoldChance { get; private set; }

	internal static ConfigEntry<float> QueenGoldChance { get; private set; }

	internal static ConfigEntry<float> FaderGoldChance { get; private set; }

	internal static ConfigEntry<float> DeepNorthGoldChance { get; private set; }

	internal static ConfigEntry<float> ModerMithrilChance { get; private set; }

	internal static ConfigEntry<float> FaderMithrilChance { get; private set; }

	internal static ConfigEntry<float> EikthyrCopperChance { get; private set; }

	internal static ConfigEntry<float> ElderCopperChance { get; private set; }

	internal static ConfigEntry<float> BonemassCopperChance { get; private set; }

	internal static ConfigEntry<float> ModerCopperChance { get; private set; }

	internal static ConfigEntry<float> YagluthCopperChance { get; private set; }

	internal static ConfigEntry<float> QueenCopperChance { get; private set; }

	internal static ConfigEntry<float> FaderCopperChance { get; private set; }

	internal static ConfigEntry<float> DeepNorthCopperChance { get; private set; }

	internal static ConfigEntry<int> EikthyrCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> EikthyrCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> ElderCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> ElderCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> BonemassCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> BonemassCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> ModerCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> ModerCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> YagluthCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> YagluthCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> QueenCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> QueenCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> FaderCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> FaderCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> DeepNorthCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> DeepNorthCopperAmountMax { get; private set; }

	internal static ConfigEntry<float> ElderBronzeChance { get; private set; }

	internal static ConfigEntry<float> BonemassBronzeChance { get; private set; }

	internal static ConfigEntry<float> ModerBronzeChance { get; private set; }

	internal static ConfigEntry<float> YagluthBronzeChance { get; private set; }

	internal static ConfigEntry<float> QueenBronzeChance { get; private set; }

	internal static ConfigEntry<float> FaderBronzeChance { get; private set; }

	internal static ConfigEntry<float> DeepNorthBronzeChance { get; private set; }

	internal static ConfigEntry<float> BonemassIronChance { get; private set; }

	internal static ConfigEntry<float> ModerIronChance { get; private set; }

	internal static ConfigEntry<float> YagluthIronChance { get; private set; }

	internal static ConfigEntry<float> QueenIronChance { get; private set; }

	internal static ConfigEntry<float> FaderIronChance { get; private set; }

	internal static ConfigEntry<float> DeepNorthIronChance { get; private set; }

	internal static ConfigEntry<float> ModerSilverChance { get; private set; }

	internal static ConfigEntry<float> YagluthSilverChance { get; private set; }

	internal static ConfigEntry<float> QueenSilverChance { get; private set; }

	internal static ConfigEntry<float> FaderSilverChance { get; private set; }

	internal static ConfigEntry<float> DeepNorthSilverChance { get; private set; }

	internal static ConfigEntry<float> GreylingCopperChance { get; private set; }

	internal static ConfigEntry<float> GreydwarfCopperChance { get; private set; }

	internal static ConfigEntry<float> GreydwarfEliteCopperChance { get; private set; }

	internal static ConfigEntry<float> TrollCopperChance { get; private set; }

	internal static ConfigEntry<float> GreydwarfBronzeChance { get; private set; }

	internal static ConfigEntry<float> GreydwarfShamanBronzeChance { get; private set; }

	internal static ConfigEntry<float> GreydwarfEliteBronzeChance { get; private set; }

	internal static ConfigEntry<float> TrollBronzeChance { get; private set; }

	internal static ConfigEntry<float> SkeletonBronzeChance { get; private set; }

	internal static ConfigEntry<float> RancidRemainsBronzeChance { get; private set; }

	internal static ConfigEntry<float> DraugrIronChance { get; private set; }

	internal static ConfigEntry<float> DraugrEliteIronChance { get; private set; }

	internal static ConfigEntry<float> WraithIronChance { get; private set; }

	internal static ConfigEntry<float> SurtlingIronChance { get; private set; }

	internal static ConfigEntry<float> UlvSilverChance { get; private set; }

	internal static ConfigEntry<float> CultistSilverChance { get; private set; }

	internal static ConfigEntry<float> FenringSilverChance { get; private set; }

	internal static ConfigEntry<float> StoneGolemSilverChance { get; private set; }

	internal static ConfigEntry<float> WraithSilverChance { get; private set; }

	internal static ConfigEntry<float> DvergerSilverChance { get; private set; }

	internal static ConfigEntry<float> GoblinIronChance { get; private set; }

	internal static ConfigEntry<float> GoblinBronzeChance { get; private set; }

	internal static ConfigEntry<float> GoblinCopperChance { get; private set; }

	internal static ConfigEntry<float> GoblinShamanIronChance { get; private set; }

	internal static ConfigEntry<float> GoblinShamanBronzeChance { get; private set; }

	internal static ConfigEntry<float> GoblinShamanCopperChance { get; private set; }

	internal static ConfigEntry<float> GoblinBruteIronChance { get; private set; }

	internal static ConfigEntry<float> GoblinBruteBronzeChance { get; private set; }

	internal static ConfigEntry<float> GoblinBruteCopperChance { get; private set; }

	internal static ConfigEntry<float> ValkyrieGoldChance { get; private set; }

	internal static ConfigEntry<float> ValkyrieSilverChance { get; private set; }

	internal static ConfigEntry<float> CharredIronChance { get; private set; }

	internal static ConfigEntry<float> GreydwarfShamanCopperChance { get; private set; }

	internal static ConfigEntry<float> SkeletonCopperChance { get; private set; }

	internal static ConfigEntry<float> DraugrCopperChance { get; private set; }

	internal static ConfigEntry<float> DraugrEliteCopperChance { get; private set; }

	internal static ConfigEntry<float> DvergerCopperChance { get; private set; }

	internal static ConfigEntry<int> GreylingCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> GreylingCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> GreydwarfCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> GreydwarfCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> GreydwarfShamanCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> GreydwarfShamanCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> GreydwarfEliteCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> GreydwarfEliteCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> SkeletonCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> SkeletonCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> TrollCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> TrollCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> DraugrCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> DraugrCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> DraugrEliteCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> DraugrEliteCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinShamanCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinShamanCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinBruteCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinBruteCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> DvergerCopperAmountMin { get; private set; }

	internal static ConfigEntry<int> DvergerCopperAmountMax { get; private set; }

	internal static ConfigEntry<int> ElderBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> ElderBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> BonemassBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> BonemassBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> ModerBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> ModerBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> YagluthBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> YagluthBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> QueenBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> QueenBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> FaderBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> FaderBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> DeepNorthBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> DeepNorthBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> BonemassIronAmountMin { get; private set; }

	internal static ConfigEntry<int> BonemassIronAmountMax { get; private set; }

	internal static ConfigEntry<int> ModerIronAmountMin { get; private set; }

	internal static ConfigEntry<int> ModerIronAmountMax { get; private set; }

	internal static ConfigEntry<int> YagluthIronAmountMin { get; private set; }

	internal static ConfigEntry<int> YagluthIronAmountMax { get; private set; }

	internal static ConfigEntry<int> QueenIronAmountMin { get; private set; }

	internal static ConfigEntry<int> QueenIronAmountMax { get; private set; }

	internal static ConfigEntry<int> FaderIronAmountMin { get; private set; }

	internal static ConfigEntry<int> FaderIronAmountMax { get; private set; }

	internal static ConfigEntry<int> DeepNorthIronAmountMin { get; private set; }

	internal static ConfigEntry<int> DeepNorthIronAmountMax { get; private set; }

	internal static ConfigEntry<int> ModerSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> ModerSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> YagluthSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> YagluthSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> QueenSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> QueenSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> FaderSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> FaderSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> DeepNorthSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> DeepNorthSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> GreydwarfBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> GreydwarfBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> GreydwarfShamanBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> GreydwarfShamanBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> GreydwarfEliteBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> GreydwarfEliteBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> TrollBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> TrollBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> SkeletonBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> SkeletonBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> RancidRemainsBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> RancidRemainsBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinShamanBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinShamanBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinBruteBronzeAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinBruteBronzeAmountMax { get; private set; }

	internal static ConfigEntry<int> DraugrIronAmountMin { get; private set; }

	internal static ConfigEntry<int> DraugrIronAmountMax { get; private set; }

	internal static ConfigEntry<int> DraugrEliteIronAmountMin { get; private set; }

	internal static ConfigEntry<int> DraugrEliteIronAmountMax { get; private set; }

	internal static ConfigEntry<int> WraithIronAmountMin { get; private set; }

	internal static ConfigEntry<int> WraithIronAmountMax { get; private set; }

	internal static ConfigEntry<int> SurtlingIronAmountMin { get; private set; }

	internal static ConfigEntry<int> SurtlingIronAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinIronAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinIronAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinShamanIronAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinShamanIronAmountMax { get; private set; }

	internal static ConfigEntry<int> GoblinBruteIronAmountMin { get; private set; }

	internal static ConfigEntry<int> GoblinBruteIronAmountMax { get; private set; }

	internal static ConfigEntry<int> CharredIronAmountMin { get; private set; }

	internal static ConfigEntry<int> CharredIronAmountMax { get; private set; }

	internal static ConfigEntry<int> UlvSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> UlvSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> CultistSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> CultistSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> FenringSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> FenringSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> StoneGolemSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> StoneGolemSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> WraithSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> WraithSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> DvergerSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> DvergerSilverAmountMax { get; private set; }

	internal static ConfigEntry<int> ValkyrieSilverAmountMin { get; private set; }

	internal static ConfigEntry<int> ValkyrieSilverAmountMax { get; private set; }

	internal static void Bind(ConfigFile config)
	{
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Expected O, but got Unknown
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Expected O, but got Unknown
		AllowTraderSales = config.Bind<bool>("General", "Allow coin sales to traders", true, "When enabled, each coin can be sold to a trader for its face value. Enabled by default.");
		EnableBossDrops = config.Bind<bool>("General", "Enable boss coin drops", true, "Enable all configured Ravenwood coin drops from bosses.");
		EnableMonsterDrops = config.Bind<bool>("General", "Enable monster coin drops", true, "Enable all configured Ravenwood coin drops from regular monsters.");
		TableBuildCost = config.Bind<string>("Building", "Table build cost", "[RWc_Deer][10][RWc_Bear][5][RWc_Snake][2][RWc_Wolf][1]", "Build requirements in [Prefab][Amount] format.");
		ChestBuildCost = config.Bind<string>("Building", "Chest build cost", "[RWc_Deer][1][RWc_Bear][1][RWc_Snake][1][RWc_Wolf][1]", "Build requirements in [Prefab][Amount] format.");
		if (TableBuildCost.Value == "[FineWood][20][Iron][5][SurtlingCore][2]" || TableBuildCost.Value == "[RWc_Deer][10][RWc_Bear][10][RWc_Snake][10][RWc_Wolf][10]")
		{
			TableBuildCost.Value = "[RWc_Deer][10][RWc_Bear][5][RWc_Snake][2][RWc_Wolf][1]";
		}
		if (ChestBuildCost.Value == "[FineWood][10][Iron][2]" || ChestBuildCost.Value == "[RWc_Deer][5][RWc_Bear][5][RWc_Snake][2][RWc_Wolf][2]")
		{
			ChestBuildCost.Value = "[RWc_Deer][1][RWc_Bear][1][RWc_Snake][1][RWc_Wolf][1]";
		}
		ChestWidth = config.Bind<int>("Building", "Chest width", 8, new ConfigDescription("Standalone chest inventory width.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), Array.Empty<object>()));
		ChestHeight = config.Bind<int>("Building", "Chest height", 4, new ConfigDescription("Standalone chest inventory height.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), Array.Empty<object>()));
		AcceptableValueRange<float> range = new AcceptableValueRange<float>(0f, 100f);
		EikthyrGoldChance = BindChance(config, "Eikthyr Gold chance", 1f, range);
		ElderGoldChance = BindChance(config, "Elder Gold chance", 2f, range);
		BonemassGoldChance = BindChance(config, "Bonemass Gold chance", 5f, range);
		ModerGoldChance = BindChance(config, "Moder Gold chance", 10f, range);
		YagluthGoldChance = BindChance(config, "Yagluth Gold chance", 12f, range);
		QueenGoldChance = BindChance(config, "Queen Gold chance", 15f, range);
		FaderGoldChance = BindChance(config, "Fader Gold chance", 20f, range);
		DeepNorthGoldChance = BindChance(config, "Deep North boss Gold chance", 25f, range);
		ModerMithrilChance = BindChance(config, "Moder Mithril chance", 1f, range);
		FaderMithrilChance = BindChance(config, "Fader Mithril chance", 5f, range);
		EikthyrCopperChance = BindChance(config, "Eikthyr Copper chance", 40f, range);
		ElderCopperChance = BindChance(config, "Elder Copper chance", 40f, range);
		BonemassCopperChance = BindChance(config, "Bonemass Copper chance", 40f, range);
		ModerCopperChance = BindChance(config, "Moder Copper chance", 40f, range);
		YagluthCopperChance = BindChance(config, "Yagluth Copper chance", 40f, range);
		QueenCopperChance = BindChance(config, "Queen Copper chance", 40f, range);
		FaderCopperChance = BindChance(config, "Fader Copper chance", 40f, range);
		DeepNorthCopperChance = BindChance(config, "Deep North boss Copper chance", 40f, range);
		EikthyrCopperAmountMin = BindAmount(config, "Boss Drops", "Eikthyr Copper minimum amount", 1);
		EikthyrCopperAmountMax = BindAmount(config, "Boss Drops", "Eikthyr Copper maximum amount", 3);
		ElderCopperAmountMin = BindAmount(config, "Boss Drops", "Elder Copper minimum amount", 1);
		ElderCopperAmountMax = BindAmount(config, "Boss Drops", "Elder Copper maximum amount", 5);
		BonemassCopperAmountMin = BindAmount(config, "Boss Drops", "Bonemass Copper minimum amount", 3);
		BonemassCopperAmountMax = BindAmount(config, "Boss Drops", "Bonemass Copper maximum amount", 8);
		ModerCopperAmountMin = BindAmount(config, "Boss Drops", "Moder Copper minimum amount", 5);
		ModerCopperAmountMax = BindAmount(config, "Boss Drops", "Moder Copper maximum amount", 10);
		YagluthCopperAmountMin = BindAmount(config, "Boss Drops", "Yagluth Copper minimum amount", 7);
		YagluthCopperAmountMax = BindAmount(config, "Boss Drops", "Yagluth Copper maximum amount", 12);
		QueenCopperAmountMin = BindAmount(config, "Boss Drops", "Queen Copper minimum amount", 10);
		QueenCopperAmountMax = BindAmount(config, "Boss Drops", "Queen Copper maximum amount", 15);
		FaderCopperAmountMin = BindAmount(config, "Boss Drops", "Fader Copper minimum amount", 15);
		FaderCopperAmountMax = BindAmount(config, "Boss Drops", "Fader Copper maximum amount", 20);
		DeepNorthCopperAmountMin = BindAmount(config, "Boss Drops", "Deep North boss Copper minimum amount", 15);
		DeepNorthCopperAmountMax = BindAmount(config, "Boss Drops", "Deep North boss Copper maximum amount", 20);
		ElderBronzeChance = BindChance(config, "Elder Bronze chance", 25f, range);
		BonemassBronzeChance = BindChance(config, "Bonemass Bronze chance", 25f, range);
		ModerBronzeChance = BindChance(config, "Moder Bronze chance", 25f, range);
		YagluthBronzeChance = BindChance(config, "Yagluth Bronze chance", 25f, range);
		QueenBronzeChance = BindChance(config, "Queen Bronze chance", 25f, range);
		FaderBronzeChance = BindChance(config, "Fader Bronze chance", 25f, range);
		DeepNorthBronzeChance = BindChance(config, "Deep North boss Bronze chance", 25f, range);
		BonemassIronChance = BindChance(config, "Bonemass Iron chance", 25f, range);
		ModerIronChance = BindChance(config, "Moder Iron chance", 25f, range);
		YagluthIronChance = BindChance(config, "Yagluth Iron chance", 25f, range);
		QueenIronChance = BindChance(config, "Queen Iron chance", 25f, range);
		FaderIronChance = BindChance(config, "Fader Iron chance", 25f, range);
		DeepNorthIronChance = BindChance(config, "Deep North boss Iron chance", 25f, range);
		ModerSilverChance = BindChance(config, "Moder Silver chance", 25f, range);
		YagluthSilverChance = BindChance(config, "Yagluth Silver chance", 25f, range);
		QueenSilverChance = BindChance(config, "Queen Silver chance", 25f, range);
		FaderSilverChance = BindChance(config, "Fader Silver chance", 25f, range);
		DeepNorthSilverChance = BindChance(config, "Deep North boss Silver chance", 25f, range);
		ElderBronzeAmountMin = BindAmount(config, "Boss Drops", "Elder Bronze minimum amount", 1);
		ElderBronzeAmountMax = BindAmount(config, "Boss Drops", "Elder Bronze maximum amount", 1);
		BonemassBronzeAmountMin = BindAmount(config, "Boss Drops", "Bonemass Bronze minimum amount", 1);
		BonemassBronzeAmountMax = BindAmount(config, "Boss Drops", "Bonemass Bronze maximum amount", 2);
		ModerBronzeAmountMin = BindAmount(config, "Boss Drops", "Moder Bronze minimum amount", 1);
		ModerBronzeAmountMax = BindAmount(config, "Boss Drops", "Moder Bronze maximum amount", 3);
		YagluthBronzeAmountMin = BindAmount(config, "Boss Drops", "Yagluth Bronze minimum amount", 1);
		YagluthBronzeAmountMax = BindAmount(config, "Boss Drops", "Yagluth Bronze maximum amount", 4);
		QueenBronzeAmountMin = BindAmount(config, "Boss Drops", "Queen Bronze minimum amount", 1);
		QueenBronzeAmountMax = BindAmount(config, "Boss Drops", "Queen Bronze maximum amount", 5);
		FaderBronzeAmountMin = BindAmount(config, "Boss Drops", "Fader Bronze minimum amount", 1);
		FaderBronzeAmountMax = BindAmount(config, "Boss Drops", "Fader Bronze maximum amount", 6);
		DeepNorthBronzeAmountMin = BindAmount(config, "Boss Drops", "Deep North boss Bronze minimum amount", 1);
		DeepNorthBronzeAmountMax = BindAmount(config, "Boss Drops", "Deep North boss Bronze maximum amount", 7);
		BonemassIronAmountMin = BindAmount(config, "Boss Drops", "Bonemass Iron minimum amount", 1);
		BonemassIronAmountMax = BindAmount(config, "Boss Drops", "Bonemass Iron maximum amount", 1);
		ModerIronAmountMin = BindAmount(config, "Boss Drops", "Moder Iron minimum amount", 1);
		ModerIronAmountMax = BindAmount(config, "Boss Drops", "Moder Iron maximum amount", 2);
		YagluthIronAmountMin = BindAmount(config, "Boss Drops", "Yagluth Iron minimum amount", 1);
		YagluthIronAmountMax = BindAmount(config, "Boss Drops", "Yagluth Iron maximum amount", 3);
		QueenIronAmountMin = BindAmount(config, "Boss Drops", "Queen Iron minimum amount", 1);
		QueenIronAmountMax = BindAmount(config, "Boss Drops", "Queen Iron maximum amount", 4);
		FaderIronAmountMin = BindAmount(config, "Boss Drops", "Fader Iron minimum amount", 1);
		FaderIronAmountMax = BindAmount(config, "Boss Drops", "Fader Iron maximum amount", 5);
		DeepNorthIronAmountMin = BindAmount(config, "Boss Drops", "Deep North boss Iron minimum amount", 1);
		DeepNorthIronAmountMax = BindAmount(config, "Boss Drops", "Deep North boss Iron maximum amount", 6);
		ModerSilverAmountMin = BindAmount(config, "Boss Drops", "Moder Silver minimum amount", 1);
		ModerSilverAmountMax = BindAmount(config, "Boss Drops", "Moder Silver maximum amount", 1);
		YagluthSilverAmountMin = BindAmount(config, "Boss Drops", "Yagluth Silver minimum amount", 1);
		YagluthSilverAmountMax = BindAmount(config, "Boss Drops", "Yagluth Silver maximum amount", 2);
		QueenSilverAmountMin = BindAmount(config, "Boss Drops", "Queen Silver minimum amount", 1);
		QueenSilverAmountMax = BindAmount(config, "Boss Drops", "Queen Silver maximum amount", 3);
		FaderSilverAmountMin = BindAmount(config, "Boss Drops", "Fader Silver minimum amount", 1);
		FaderSilverAmountMax = BindAmount(config, "Boss Drops", "Fader Silver maximum amount", 4);
		DeepNorthSilverAmountMin = BindAmount(config, "Boss Drops", "Deep North boss Silver minimum amount", 1);
		DeepNorthSilverAmountMax = BindAmount(config, "Boss Drops", "Deep North boss Silver maximum amount", 5);
		DeepNorthBossPrefab = config.Bind<string>("Boss Drops", "Deep North boss prefab", "DeepNorthBoss", "Internal prefab name for the Deep North boss. Change this when the final/custom boss prefab name is known.");
		GreylingCopperChance = BindMonsterChance(config, "Greyling Copper chance", 5f, range);
		GreydwarfCopperChance = BindMonsterChance(config, "Greydwarf Copper chance", 5f, range);
		GreydwarfShamanCopperChance = BindMonsterChance(config, "Greydwarf Shaman Copper chance", 5f, range);
		GreydwarfEliteCopperChance = BindMonsterChance(config, "Greydwarf Brute Copper chance", 5f, range);
		SkeletonCopperChance = BindMonsterChance(config, "Skeleton Copper chance", 5f, range);
		TrollCopperChance = BindMonsterChance(config, "Troll Copper chance", 25f, range);
		DraugrCopperChance = BindMonsterChance(config, "Draugr Copper chance", 8f, range);
		DraugrEliteCopperChance = BindMonsterChance(config, "Draugr Elite Copper chance", 8f, range);
		DvergerCopperChance = BindMonsterChance(config, "Dverger Rogue/Mage Copper chance", 12f, range);
		GreylingCopperAmountMin = BindAmount(config, "Monster Drops", "Greyling Copper minimum amount", 1);
		GreylingCopperAmountMax = BindAmount(config, "Monster Drops", "Greyling Copper maximum amount", 1);
		GreydwarfCopperAmountMin = BindAmount(config, "Monster Drops", "Greydwarf Copper minimum amount", 1);
		GreydwarfCopperAmountMax = BindAmount(config, "Monster Drops", "Greydwarf Copper maximum amount", 2);
		GreydwarfShamanCopperAmountMin = BindAmount(config, "Monster Drops", "Greydwarf Shaman Copper minimum amount", 1);
		GreydwarfShamanCopperAmountMax = BindAmount(config, "Monster Drops", "Greydwarf Shaman Copper maximum amount", 2);
		GreydwarfEliteCopperAmountMin = BindAmount(config, "Monster Drops", "Greydwarf Brute Copper minimum amount", 1);
		GreydwarfEliteCopperAmountMax = BindAmount(config, "Monster Drops", "Greydwarf Brute Copper maximum amount", 3);
		SkeletonCopperAmountMin = BindAmount(config, "Monster Drops", "Skeleton Copper minimum amount", 1);
		SkeletonCopperAmountMax = BindAmount(config, "Monster Drops", "Skeleton Copper maximum amount", 2);
		TrollCopperAmountMin = BindAmount(config, "Monster Drops", "Troll Copper minimum amount", 1);
		TrollCopperAmountMax = BindAmount(config, "Monster Drops", "Troll Copper maximum amount", 5);
		DraugrCopperAmountMin = BindAmount(config, "Monster Drops", "Draugr Copper minimum amount", 1);
		DraugrCopperAmountMax = BindAmount(config, "Monster Drops", "Draugr Copper maximum amount", 4);
		DraugrEliteCopperAmountMin = BindAmount(config, "Monster Drops", "Draugr Elite Copper minimum amount", 1);
		DraugrEliteCopperAmountMax = BindAmount(config, "Monster Drops", "Draugr Elite Copper maximum amount", 5);
		GoblinCopperAmountMin = BindAmount(config, "Monster Drops", "Goblin Copper minimum amount", 1);
		GoblinCopperAmountMax = BindAmount(config, "Monster Drops", "Goblin Copper maximum amount", 6);
		GoblinShamanCopperAmountMin = BindAmount(config, "Monster Drops", "Goblin Shaman Copper minimum amount", 1);
		GoblinShamanCopperAmountMax = BindAmount(config, "Monster Drops", "Goblin Shaman Copper maximum amount", 7);
		GoblinBruteCopperAmountMin = BindAmount(config, "Monster Drops", "Goblin Brute Copper minimum amount", 1);
		GoblinBruteCopperAmountMax = BindAmount(config, "Monster Drops", "Goblin Brute Copper maximum amount", 8);
		DvergerCopperAmountMin = BindAmount(config, "Monster Drops", "Dverger Rogue/Mage Copper minimum amount", 1);
		DvergerCopperAmountMax = BindAmount(config, "Monster Drops", "Dverger Rogue/Mage Copper maximum amount", 10);
		GreydwarfBronzeChance = BindMonsterChance(config, "Greydwarf Bronze chance", 1f, range);
		GreydwarfShamanBronzeChance = BindMonsterChance(config, "Greydwarf Shaman Bronze chance", 2f, range);
		GreydwarfEliteBronzeChance = BindMonsterChance(config, "Greydwarf Brute Bronze chance", 3f, range);
		TrollBronzeChance = BindMonsterChance(config, "Troll Bronze chance", 5f, range);
		SkeletonBronzeChance = BindMonsterChance(config, "Skeleton Bronze chance", 1f, range);
		RancidRemainsBronzeChance = BindMonsterChance(config, "Rancid Remains Bronze chance", 3f, range);
		DraugrIronChance = BindMonsterChance(config, "Draugr Iron chance", 1f, range);
		DraugrEliteIronChance = BindMonsterChance(config, "Draugr Elite Iron chance", 2f, range);
		WraithIronChance = BindMonsterChance(config, "Wraith Iron chance", 3f, range);
		SurtlingIronChance = BindMonsterChance(config, "Surtling Iron chance", 1f, range);
		UlvSilverChance = BindMonsterChance(config, "Ulv Silver chance", 1f, range);
		CultistSilverChance = BindMonsterChance(config, "Cultist Silver chance", 2f, range);
		FenringSilverChance = BindMonsterChance(config, "Fenring Silver chance", 3f, range);
		StoneGolemSilverChance = BindMonsterChance(config, "Stone Golem Silver chance", 5f, range);
		WraithSilverChance = BindMonsterChance(config, "Wraith Silver chance", 1f, range);
		DvergerSilverChance = BindMonsterChance(config, "Dverger Silver chance", 2f, range);
		GoblinIronChance = BindMonsterChance(config, "Goblin Iron chance", 1f, range);
		GoblinBronzeChance = BindMonsterChance(config, "Goblin Bronze chance", 2f, range);
		GoblinCopperChance = BindMonsterChance(config, "Goblin Copper chance", 10f, range);
		GoblinShamanIronChance = BindMonsterChance(config, "Goblin Shaman Iron chance", 2f, range);
		GoblinShamanBronzeChance = BindMonsterChance(config, "Goblin Shaman Bronze chance", 2f, range);
		GoblinShamanCopperChance = BindMonsterChance(config, "Goblin Shaman Copper chance", 10f, range);
		GoblinBruteIronChance = BindMonsterChance(config, "Goblin Brute Iron chance", 3f, range);
		GoblinBruteBronzeChance = BindMonsterChance(config, "Goblin Brute Bronze chance", 4f, range);
		GoblinBruteCopperChance = BindMonsterChance(config, "Goblin Brute Copper chance", 10f, range);
		ValkyrieGoldChance = BindMonsterChance(config, "Valkyrie Gold chance", 1f, range);
		ValkyrieSilverChance = BindMonsterChance(config, "Valkyrie Silver chance", 5f, range);
		CharredIronChance = BindMonsterChance(config, "Ashlands Charred Iron chance", 5f, range);
		GreydwarfBronzeAmountMin = BindAmount(config, "Monster Drops", "Greydwarf Bronze minimum amount", 1);
		GreydwarfBronzeAmountMax = BindAmount(config, "Monster Drops", "Greydwarf Bronze maximum amount", 1);
		GreydwarfShamanBronzeAmountMin = BindAmount(config, "Monster Drops", "Greydwarf Shaman Bronze minimum amount", 1);
		GreydwarfShamanBronzeAmountMax = BindAmount(config, "Monster Drops", "Greydwarf Shaman Bronze maximum amount", 1);
		GreydwarfEliteBronzeAmountMin = BindAmount(config, "Monster Drops", "Greydwarf Brute Bronze minimum amount", 1);
		GreydwarfEliteBronzeAmountMax = BindAmount(config, "Monster Drops", "Greydwarf Brute Bronze maximum amount", 1);
		TrollBronzeAmountMin = BindAmount(config, "Monster Drops", "Troll Bronze minimum amount", 1);
		TrollBronzeAmountMax = BindAmount(config, "Monster Drops", "Troll Bronze maximum amount", 1);
		SkeletonBronzeAmountMin = BindAmount(config, "Monster Drops", "Skeleton Bronze minimum amount", 1);
		SkeletonBronzeAmountMax = BindAmount(config, "Monster Drops", "Skeleton Bronze maximum amount", 1);
		RancidRemainsBronzeAmountMin = BindAmount(config, "Monster Drops", "Rancid Remains Bronze minimum amount", 1);
		RancidRemainsBronzeAmountMax = BindAmount(config, "Monster Drops", "Rancid Remains Bronze maximum amount", 1);
		GoblinBronzeAmountMin = BindAmount(config, "Monster Drops", "Goblin Bronze minimum amount", 1);
		GoblinBronzeAmountMax = BindAmount(config, "Monster Drops", "Goblin Bronze maximum amount", 2);
		GoblinShamanBronzeAmountMin = BindAmount(config, "Monster Drops", "Goblin Shaman Bronze minimum amount", 1);
		GoblinShamanBronzeAmountMax = BindAmount(config, "Monster Drops", "Goblin Shaman Bronze maximum amount", 2);
		GoblinBruteBronzeAmountMin = BindAmount(config, "Monster Drops", "Goblin Brute Bronze minimum amount", 1);
		GoblinBruteBronzeAmountMax = BindAmount(config, "Monster Drops", "Goblin Brute Bronze maximum amount", 2);
		DraugrIronAmountMin = BindAmount(config, "Monster Drops", "Draugr Iron minimum amount", 1);
		DraugrIronAmountMax = BindAmount(config, "Monster Drops", "Draugr Iron maximum amount", 1);
		DraugrEliteIronAmountMin = BindAmount(config, "Monster Drops", "Draugr Elite Iron minimum amount", 1);
		DraugrEliteIronAmountMax = BindAmount(config, "Monster Drops", "Draugr Elite Iron maximum amount", 1);
		WraithIronAmountMin = BindAmount(config, "Monster Drops", "Wraith Iron minimum amount", 1);
		WraithIronAmountMax = BindAmount(config, "Monster Drops", "Wraith Iron maximum amount", 1);
		SurtlingIronAmountMin = BindAmount(config, "Monster Drops", "Surtling Iron minimum amount", 1);
		SurtlingIronAmountMax = BindAmount(config, "Monster Drops", "Surtling Iron maximum amount", 1);
		GoblinIronAmountMin = BindAmount(config, "Monster Drops", "Goblin Iron minimum amount", 1);
		GoblinIronAmountMax = BindAmount(config, "Monster Drops", "Goblin Iron maximum amount", 2);
		GoblinShamanIronAmountMin = BindAmount(config, "Monster Drops", "Goblin Shaman Iron minimum amount", 1);
		GoblinShamanIronAmountMax = BindAmount(config, "Monster Drops", "Goblin Shaman Iron maximum amount", 2);
		GoblinBruteIronAmountMin = BindAmount(config, "Monster Drops", "Goblin Brute Iron minimum amount", 1);
		GoblinBruteIronAmountMax = BindAmount(config, "Monster Drops", "Goblin Brute Iron maximum amount", 2);
		CharredIronAmountMin = BindAmount(config, "Monster Drops", "Ashlands Charred Iron minimum amount", 1);
		CharredIronAmountMax = BindAmount(config, "Monster Drops", "Ashlands Charred Iron maximum amount", 1);
		UlvSilverAmountMin = BindAmount(config, "Monster Drops", "Ulv Silver minimum amount", 1);
		UlvSilverAmountMax = BindAmount(config, "Monster Drops", "Ulv Silver maximum amount", 1);
		CultistSilverAmountMin = BindAmount(config, "Monster Drops", "Cultist Silver minimum amount", 1);
		CultistSilverAmountMax = BindAmount(config, "Monster Drops", "Cultist Silver maximum amount", 1);
		FenringSilverAmountMin = BindAmount(config, "Monster Drops", "Fenring Silver minimum amount", 1);
		FenringSilverAmountMax = BindAmount(config, "Monster Drops", "Fenring Silver maximum amount", 1);
		StoneGolemSilverAmountMin = BindAmount(config, "Monster Drops", "Stone Golem Silver minimum amount", 1);
		StoneGolemSilverAmountMax = BindAmount(config, "Monster Drops", "Stone Golem Silver maximum amount", 1);
		WraithSilverAmountMin = BindAmount(config, "Monster Drops", "Wraith Silver minimum amount", 1);
		WraithSilverAmountMax = BindAmount(config, "Monster Drops", "Wraith Silver maximum amount", 1);
		DvergerSilverAmountMin = BindAmount(config, "Monster Drops", "Dverger Silver minimum amount", 1);
		DvergerSilverAmountMax = BindAmount(config, "Monster Drops", "Dverger Silver maximum amount", 2);
		ValkyrieSilverAmountMin = BindAmount(config, "Monster Drops", "Valkyrie Silver minimum amount", 1);
		ValkyrieSilverAmountMax = BindAmount(config, "Monster Drops", "Valkyrie Silver maximum amount", 1);
	}

	private static ConfigEntry<float> BindChance(ConfigFile config, string key, float defaultValue, AcceptableValueRange<float> range)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		return config.Bind<float>("Boss Drops", key, defaultValue, new ConfigDescription("Percent chance for this boss coin drop.", (AcceptableValueBase)(object)range, Array.Empty<object>()));
	}

	private static ConfigEntry<float> BindMonsterChance(ConfigFile config, string key, float defaultValue, AcceptableValueRange<float> range)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		return config.Bind<float>("Monster Drops", key, defaultValue, new ConfigDescription("Percent chance for this monster coin drop.", (AcceptableValueBase)(object)range, Array.Empty<object>()));
	}

	private static ConfigEntry<int> BindAmount(ConfigFile config, string section, string key, int defaultValue)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		return config.Bind<int>(section, key, defaultValue, new ConfigDescription("Number of coins dropped.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 999), Array.Empty<object>()));
	}
}
internal sealed class CoinDefinition
{
	internal string PrefabName { get; }

	internal string DisplayName { get; }

	internal int Value { get; }

	internal CoinDefinition(string prefabName, string displayName, int value)
	{
		PrefabName = prefabName;
		DisplayName = displayName;
		Value = value;
	}
}
internal sealed class StatueDefinition
{
	internal int Tier { get; }

	internal string PrefabName { get; }

	internal string DisplayName { get; }

	internal string Description { get; }

	internal string IconPrefab { get; }

	internal string RequiredStation { get; }

	internal string BuildCost { get; }

	internal StatueDefinition(int tier, string prefabName, string displayName, string description, string iconPrefab, string requiredStation, string buildCost)
	{
		Tier = tier;
		PrefabName = prefabName;
		DisplayName = displayName;
		Description = description;
		IconPrefab = iconPrefab;
		RequiredStation = requiredStation;
		BuildCost = buildCost;
	}
}
internal static class CurrencyDefinitions
{
	internal const string CopperCoin = "RWc_Deer";

	internal const string BronzeCoin = "RWc_Bear";

	internal const string IronCoin = "RWc_Snake";

	internal const string SilverCoin = "RWc_Wolf";

	internal const string GoldCoin = "RWc_Lion";

	internal const string MithrilCoin = "RWc_Raven";

	internal const string TablePrefab = "RWc_Table";

	internal const string ChestPrefab = "RWc_Chest";

	internal const string MaterialChild = "exchange_box";

	internal const string ScaleChild = "exchange_scale";

	internal static readonly IReadOnlyList<StatueDefinition> Statues = new StatueDefinition[6]
	{
		new StatueDefinition(1, "RWc_Deer_Statue", "Copper Deer Statue", "Upgrade 1: Copper Bars create 2 Copper Coins.", "RWc_Deer", "RWc_Table", "[RWc_Deer][25]"),
		new StatueDefinition(2, "RWc_Bear_Statue", "Bronze Bear Statue", "Upgrade 2: Bronze Bars create 2 Bronze Coins.", "RWc_Bear", "RWc_Deer_Statue", "[RWc_Bear][10]"),
		new StatueDefinition(3, "RWc_Snake_Statue", "Iron Snake Statue", "Upgrade 3: Iron Bars create 2 Iron Coins.", "RWc_Snake", "RWc_Bear_Statue", "[RWc_Snake][10]"),
		new StatueDefinition(4, "RWc_Wolf_Statue", "Silver Wolf Statue", "Upgrade 4: Copper Bars create 3 Copper Coins.", "RWc_Wolf", "RWc_Snake_Statue", "[RWc_Wolf][5]"),
		new StatueDefinition(5, "RWc_Lion_Statue", "Gold Lion Statue", "Upgrade 5: Copper Bars create 4 Copper Coins.", "RWc_Lion", "RWc_Wolf_Statue", "[RWc_Lion][1][RWc_Deer][50]"),
		new StatueDefinition(6, "RWc_Raven_Statue", "Mithril Raven Statue", "Upgrade 6: Bronze Bars create 3 Bronze Coins.", "RWc_Raven", "RWc_Lion_Statue", "[RWc_Raven][1][RWc_Bear][100]")
	};

	internal static readonly IReadOnlyList<CoinDefinition> Coins = new CoinDefinition[6]
	{
		new CoinDefinition("RWc_Deer", "Copper Coin", 1),
		new CoinDefinition("RWc_Bear", "Bronze Coin", 5),
		new CoinDefinition("RWc_Snake", "Iron Coin", 10),
		new CoinDefinition("RWc_Wolf", "Silver Coin", 25),
		new CoinDefinition("RWc_Lion", "Gold Coin", 100),
		new CoinDefinition("RWc_Raven", "Mithril Coin", 1000)
	};
}
internal static class CurrencyRegistrar
{
	private static readonly Dictionary<string, GameObject> CoinPrefabs = new Dictionary<string, GameObject>(StringComparer.Ordinal);

	private static bool wasAlreadyRegistered = false;

	internal static void RegisterAll(AssetBundle bundle)
	{
		if (wasAlreadyRegistered)
		{
			return;
		}
		foreach (CoinDefinition coin in CurrencyDefinitions.Coins)
		{
			RegisterCoin(bundle, coin);
		}
		RegisterTable(bundle);
		RegisterStatues(bundle);
		RegisterChest(bundle);
		wasAlreadyRegistered = true;
	}

	internal static GameObject GetCoinPrefab(string prefabName)
	{
		CoinPrefabs.TryGetValue(prefabName, out var value);
		return value;
	}

	internal static void RefreshTraderValues()
	{
		foreach (CoinDefinition coin in CurrencyDefinitions.Coins)
		{
			GameObject coinPrefab = GetCoinPrefab(coin.PrefabName);
			ItemDrop val = (((Object)(object)coinPrefab != (Object)null) ? coinPrefab.GetComponent<ItemDrop>() : null);
			if (val?.m_itemData?.m_shared != null)
			{
				val.m_itemData.m_shared.m_value = (CurrencyConfig.AllowTraderSales.Value ? coin.Value : 0);
			}
		}
	}

	internal static void RefreshPieceEffects()
	{
		CopyPieceEffects("RWc_Table", "piece_workbench");
		CopyPieceEffects("RWc_Chest", "piece_chest_wood");
		foreach (StatueDefinition statue in CurrencyDefinitions.Statues)
		{
			CopyPieceEffects(statue.PrefabName, "piece_workbench");
		}
	}

	private static void RegisterCoin(AssetBundle bundle, CoinDefinition definition)
	{
		//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_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Expected O, but got Unknown
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Expected O, but got Unknown
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Expected O, but got Unknown
		GameObject val = bundle.LoadAsset<GameObject>(definition.PrefabName);
		Sprite val2 = bundle.LoadAsset<Sprite>(definition.PrefabName);
		if ((Object)(object)val == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)("Missing coin prefab in rwc: " + definition.PrefabName));
			return;
		}
		if ((Object)(object)val2 == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)("Missing coin icon sprite in rwc: " + definition.PrefabName));
			return;
		}
		Vector3 localScale = val.transform.localScale;
		((Object)val).name = definition.PrefabName;
		PrefabRuntimeUtility.SetLayerRecursively(val, "item");
		PrefabRuntimeUtility.PrepareNetworkedPrefab(val, persistent: true);
		ZNetView component = val.GetComponent<ZNetView>();
		component.m_syncInitialScale = false;
		ZSyncTransform val3 = val.GetComponent<ZSyncTransform>() ?? val.AddComponent<ZSyncTransform>();
		val3.m_syncPosition = true;
		val3.m_syncRotation = true;
		val3.m_syncScale = false;
		Rigidbody val4 = val.GetComponent<Rigidbody>() ?? val.AddComponent<Rigidbody>();
		val4.mass = 0.1f;
		val4.drag = 0.1f;
		val4.angularDrag = 0.05f;
		val4.useGravity = true;
		val4.isKinematic = false;
		val4.detectCollisions = true;
		val4.constraints = (RigidbodyConstraints)0;
		val4.interpolation = (RigidbodyInterpolation)1;
		val4.collisionDetectionMode = (CollisionDetectionMode)2;
		ItemDrop val5 = val.GetComponent<ItemDrop>() ?? val.AddComponent<ItemDrop>();
		if (val5.m_itemData == null)
		{
			val5.m_itemData = new ItemData();
		}
		if (val5.m_itemData.m_shared == null)
		{
			val5.m_itemData.m_shared = new SharedData();
		}
		val5.m_itemData.m_dropPrefab = val;
		val5.m_itemData.m_stack = 1;
		val5.m_itemData.m_quality = 1;
		val5.m_itemData.m_variant = 0;
		val5.m_itemData.m_shared.m_name = definition.DisplayName;
		val5.m_itemData.m_shared.m_description = "Ravenwood currency worth " + definition.Value + " value.";
		val5.m_itemData.m_shared.m_itemType = (ItemType)1;
		val5.m_itemData.m_shared.m_maxStackSize = 999;
		val5.m_itemData.m_shared.m_weight = 0.01f;
		val5.m_itemData.m_shared.m_teleportable = true;
		val5.m_itemData.m_shared.m_value = (CurrencyConfig.AllowTraderSales.Value ? definition.Value : 0);
		val5.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { val2 };
		CoinWorldPhysics coinWorldPhysics = val.GetComponent<CoinWorldPhysics>() ?? val.AddComponent<CoinWorldPhysics>();
		coinWorldPhysics.Configure(localScale);
		ItemManager.Instance.AddItem(new CustomItem(val, false));
		CoinPrefabs[definition.PrefabName] = val;
	}

	private static void RegisterTable(AssetBundle bundle)
	{
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Expected O, but got Unknown
		GameObject val = bundle.LoadAsset<GameObject>("RWc_Table");
		Sprite icon = bundle.LoadAsset<Sprite>("RWc_Table");
		if ((Object)(object)val == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)"Missing table prefab in rwc: RWc_Table");
			return;
		}
		((Object)val).name = "RWc_Table";
		PrefabRuntimeUtility.SetLayer(val, "piece");
		PrefabRuntimeUtility.PrepareNetworkedPrefab(val, persistent: true);
		MaterialExchangeInteract[] componentsInChildren = val.GetComponentsInChildren<MaterialExchangeInteract>(true);
		foreach (MaterialExchangeInteract materialExchangeInteract in componentsInChildren)
		{
			Object.DestroyImmediate((Object)(object)materialExchangeInteract);
		}
		CoinExchangeInteract[] componentsInChildren2 = val.GetComponentsInChildren<CoinExchangeInteract>(true);
		foreach (CoinExchangeInteract coinExchangeInteract in componentsInChildren2)
		{
			Object.DestroyImmediate((Object)(object)coinExchangeInteract);
		}
		WearNTear[] componentsInChildren3 = val.GetComponentsInChildren<WearNTear>(true);
		foreach (WearNTear val2 in componentsInChildren3)
		{
			Object.DestroyImmediate((Object)(object)val2);
		}
		Container[] componentsInChildren4 = val.GetComponentsInChildren<Container>(true);
		foreach (Container val3 in componentsInChildren4)
		{
			Object.DestroyImmediate((Object)(object)val3);
		}
		Rigidbody[] componentsInChildren5 = val.GetComponentsInChildren<Rigidbody>(true);
		foreach (Rigidbody val4 in componentsInChildren5)
		{
			Object.DestroyImmediate((Object)(object)val4);
		}
		AttachTableInteraction(val, "exchange_box", materialExchange: true);
		AttachTableInteraction(val, "exchange_scale", materialExchange: false);
		Piece val5 = val.GetComponent<Piece>() ?? val.AddComponent<Piece>();
		val5.m_name = "Ravenwood Currency Table";
		val5.m_description = "Trade materials for coins and exchange coin denominations.";
		val5.m_icon = icon;
		val5.m_canBeRemoved = true;
		val5.m_groundOnly = false;
		val5.m_groundPiece = false;
		WearNTear val6 = val.GetComponent<WearNTear>() ?? val.AddComponent<WearNTear>();
		val6.m_health = 1000f;
		CraftingStation station = val.GetComponent<CraftingStation>() ?? val.AddComponent<CraftingStation>();
		ConfigureCraftingStation(station, "Ravenwood Currency Table", icon);
		PieceConfig val7 = CreatePieceConfig("Ravenwood Currency Table", "Trade materials for coins and exchange coin denominations.", icon, ParseRequirements(CurrencyConfig.TableBuildCost.Value));
		val7.CraftingStation = null;
		CustomPiece val8 = new CustomPiece(val, true, val7);
		PieceManager.Instance.AddPiece(val8);
	}

	private static void RegisterStatues(AssetBundle bundle)
	{
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Expected O, but got Unknown
		GameObject val = bundle.LoadAsset<GameObject>("RWc_Table");
		CraftingStation val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<CraftingStation>() : null);
		if ((Object)(object)val2 == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)"RWc_Table has no CraftingStation for statue extensions.");
			return;
		}
		foreach (StatueDefinition statue in CurrencyDefinitions.Statues)
		{
			GameObject val3 = bundle.LoadAsset<GameObject>(statue.PrefabName);
			Sprite icon = bundle.LoadAsset<Sprite>(statue.PrefabName) ?? bundle.LoadAsset<Sprite>(statue.IconPrefab);
			if ((Object)(object)val3 == (Object)null)
			{
				RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)("Missing statue prefab in rwc: " + statue.PrefabName));
				continue;
			}
			PreparePiecePrefab(val3, statue.DisplayName, statue.Description, icon, "piece_workbench");
			PrefabRuntimeUtility.PrepareStaticPiecePhysics(val3);
			CraftingStation[] componentsInChildren = val3.GetComponentsInChildren<CraftingStation>(true);
			foreach (CraftingStation val4 in componentsInChildren)
			{
				Object.DestroyImmediate((Object)(object)val4);
			}
			StationExtension val5 = val3.GetComponent<StationExtension>() ?? val3.AddComponent<StationExtension>();
			val5.m_craftingStation = val2;
			val5.m_maxStationDistance = 10f;
			val5.m_stack = false;
			StatueUpgradeMarker statueUpgradeMarker = val3.GetComponent<StatueUpgradeMarker>() ?? val3.AddComponent<StatueUpgradeMarker>();
			statueUpgradeMarker.Configure(statue.Tier);
			PieceConfig val6 = CreatePieceConfig(statue.DisplayName, statue.Description, icon, ParseRequirements(statue.BuildCost));
			val6.CraftingStation = "RWc_Table";
			PieceManager.Instance.AddPiece(new CustomPiece(val3, true, val6));
		}
	}

	private static void RegisterChest(AssetBundle bundle)
	{
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Expected O, but got Unknown
		GameObject val = bundle.LoadAsset<GameObject>("RWc_Chest");
		Sprite icon = bundle.LoadAsset<Sprite>("RWc_Chest");
		if ((Object)(object)val == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)"Missing chest prefab in rwc: RWc_Chest");
			return;
		}
		PreparePiecePrefab(val, "Ravenwood Currency Chest", "A standalone Ravenwood storage chest.", icon, "piece_chest_wood");
		Container val2 = val.GetComponent<Container>() ?? val.AddComponent<Container>();
		val2.m_name = "Ravenwood Currency Chest";
		val2.m_width = CurrencyConfig.ChestWidth.Value;
		val2.m_height = CurrencyConfig.ChestHeight.Value;
		PieceConfig val3 = CreatePieceConfig("Ravenwood Currency Chest", "A standalone Ravenwood storage chest.", icon, ParseRequirements(CurrencyConfig.ChestBuildCost.Value));
		val3.CraftingStation = null;
		PieceManager.Instance.AddPiece(new CustomPiece(val, true, val3));
	}

	private static void PreparePiecePrefab(GameObject prefab, string displayName, string description, Sprite icon, string effectSource)
	{
		((Object)prefab).name = ((Object)prefab).name.Replace("(Clone)", string.Empty);
		PrefabRuntimeUtility.SetLayerRecursively(prefab, "piece");
		PrefabRuntimeUtility.PrepareNetworkedPrefab(prefab, persistent: true);
		PrefabRuntimeUtility.EnsureCollider(prefab);
		Piece val = prefab.GetComponent<Piece>() ?? prefab.AddComponent<Piece>();
		val.m_name = displayName;
		val.m_description = description;
		val.m_icon = icon;
		val.m_canBeRemoved = true;
		val.m_groundOnly = false;
		val.m_groundPiece = false;
		WearNTear val2 = prefab.GetComponent<WearNTear>() ?? prefab.AddComponent<WearNTear>();
		val2.m_health = 1000f;
		GameObject val3 = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(effectSource) : null);
		Piece val4 = (((Object)(object)val3 != (Object)null) ? val3.GetComponent<Piece>() : null);
		WearNTear val5 = (((Object)(object)val3 != (Object)null) ? val3.GetComponent<WearNTear>() : null);
		if ((Object)(object)val4 != (Object)null)
		{
			val.m_placeEffect = val4.m_placeEffect;
		}
		if ((Object)(object)val5 != (Object)null)
		{
			val2.m_destroyedEffect = val5.m_destroyedEffect;
		}
	}

	private static void ConfigureCraftingStation(CraftingStation station, string displayName, Sprite icon)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		station.m_name = displayName;
		station.m_icon = icon;
		station.m_discoverRange = 4f;
		station.m_rangeBuild = 10f;
		station.m_extraRangePerLevel = 0f;
		station.m_craftRequireRoof = false;
		station.m_craftRequireFire = false;
		station.m_showBasicRecipies = false;
		station.m_useDistance = 2f;
		station.m_craftingSkill = (SkillType)107;
	}

	private static void CopyPieceEffects(string targetPrefabName, string sourcePrefabName)
	{
		GameObject prefab = PrefabManager.Instance.GetPrefab(targetPrefabName);
		GameObject prefab2 = PrefabManager.Instance.GetPrefab(sourcePrefabName);
		Piece val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<Piece>() : null);
		Piece val2 = (((Object)(object)prefab2 != (Object)null) ? prefab2.GetComponent<Piece>() : null);
		WearNTear val3 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<WearNTear>() : null);
		WearNTear val4 = (((Object)(object)prefab2 != (Object)null) ? prefab2.GetComponent<WearNTear>() : null);
		if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null)
		{
			val.m_placeEffect = val2.m_placeEffect;
		}
		if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null)
		{
			val3.m_destroyedEffect = val4.m_destroyedEffect;
		}
	}

	private static PieceConfig CreatePieceConfig(string name, string description, Sprite icon, RequirementConfig[] requirements)
	{
		//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_000e: 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_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		return new PieceConfig
		{
			Name = name,
			Description = description,
			PieceTable = "Hammer",
			Category = "Ravenwood",
			CraftingStation = "piece_workbench",
			Icon = icon,
			Requirements = requirements
		};
	}

	private static void AttachTableInteraction(GameObject table, string childName, bool materialExchange)
	{
		Transform val = PrefabRuntimeUtility.FindChildRecursive(table.transform, childName);
		if ((Object)(object)val == (Object)null)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogError((object)("RWc_Table is missing required child '" + childName + "'."));
			return;
		}
		PrefabRuntimeUtility.EnsureCollider(((Component)val).gameObject);
		if (materialExchange)
		{
			if ((Object)(object)((Component)val).GetComponent<MaterialExchangeInteract>() == (Object)null)
			{
				((Component)val).gameObject.AddComponent<MaterialExchangeInteract>();
			}
		}
		else if ((Object)(object)((Component)val).GetComponent<CoinExchangeInteract>() == (Object)null)
		{
			((Component)val).gameObject.AddComponent<CoinExchangeInteract>();
		}
	}

	private static RequirementConfig[] ParseRequirements(string value)
	{
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		List<RequirementConfig> list = new List<RequirementConfig>();
		MatchCollection source = Regex.Matches(value ?? string.Empty, "\\[([^\\]]+)\\]\\[(\\d+)\\]");
		foreach (Match item in source.Cast<Match>())
		{
			if (int.TryParse(item.Groups[2].Value, out var result) && result > 0)
			{
				list.Add(new RequirementConfig(item.Groups[1].Value, result, 0, true));
			}
		}
		if (list.Count == 0)
		{
			RavenwoodCurrencyPlugin.Instance.ModLogger.LogWarning((object)("Invalid build requirement string: " + value));
		}
		return list.ToArray();
	}
}
internal sealed class CoinWorldPhysics : MonoBehaviour
{
	[SerializeField]
	private Vector3 _authoredScale = Vector3.one;

	[SerializeField]
	private bool _configured;

	internal void Configure(Vector3 authoredScale)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		_authoredScale = authoredScale;
		_configured = true;
		Apply();
	}

	private void Awake()
	{
		Apply();
	}

	private void OnEnable()
	{
		Apply();
	}

	private void Start()
	{
		Apply();
	}

	private void Apply()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		if (_configured)
		{
			((Component)this).transform.localScale = _authoredScale;
			Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.useGravity = true;
				component.isKinematic = false;
				component.detectCollisions = true;
				component.constraints = (RigidbodyConstraints)0;
				component.interpolation = (RigidbodyInterpolation)1;
				component.collisionDetectionMode = (CollisionDetectionMode)2;
				component.WakeUp();
			}
		}
	}
}
internal static class ExchangeMenu
{
	private static readonly List<GameObject> TradeButtons = new List<GameObject>();

	private static GameObject _panel;

	private static Text _title;

	private static Text _subtitle;

	private static Text _status;

	private static Player _player;

	private static CraftingStation _tableStation;

	private static ExchangeMenuMode _mode;

	private static bool _isOpen;

	internal static void OnCustomGUIAvailable()
	{
		if (_isOpen)
		{
			GUIManager.BlockInput(false);
		}
		if ((Object)(object)_panel != (Object)null)
		{
			Object.Destroy((Object)(object)_panel);
		}
		_isOpen = false;
		_player = null;
		_tableStation = null;
		CreateGui();
	}

	internal static void Show(ExchangeMenuMode mode, Player player, CraftingStation tableStation)
	{
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_panel == (Object)null)
		{
			CreateGui();
		}
		if ((Object)(object)_panel == (Object)null)
		{
			if (player != null)
			{
				((Character)player).Message((MessageType)2, "Ravenwood exchange menu is not available yet.", 0, (Sprite)null);
			}
			return;
		}
		_player = player;
		_tableStation = tableStation;
		_mode = mode;
		Populate(mode);
		_status.text = "Select a trade. Materials are taken from your inventory.";
		((Graphic)_status).color = Color.white;
		_panel.SetActive(true);
		_isOpen = true;
		GUIManager.BlockInput(true);
	}

	internal static void Close()
	{
		if ((Object)(object)_panel != (Object)null)
		{
			_panel.SetActive(false);
		}
		if (_isOpen)
		{
			GUIManager.BlockInput(false);
		}
		_player = null;
		_tableStation = null;
		_isOpen = false;
	}

	internal static void Tick()
	{
		if (_isOpen && ((Object)(object)_player == (Object)null || Input.GetKeyDown((KeyCode)27)))
		{
			Close();
		}
	}

	private static void CreateGui()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: 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_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Expected O, but got Unknown
		if (GUIManager.Instance != null && !((Object)(object)GUIManager.CustomGUIFront == (Object)null))
		{
			_panel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 980f, 760f, false);
			((Object)_panel).name = "RavenwoodCurrencyExchangePanel";
			_panel.SetActive(false);
			_title = CreateText(string.Empty, new Vector2(0f, -42f), 30, GUIManager.Instance.ValheimOrange, 850f, 45f);
			_subtitle = CreateText(string.Empty, new Vector2(0f, -82f), 18, GUIManager.Instance.ValheimBeige, 850f, 35f);
			_status = CreateText(string.Empty, new Vector2(0f, -706f), 17, Color.white, 880f, 38f);
			GameObject val = GUIManager.Instance.CreateButton("X", _panel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(445f, 340f), 48f, 44f);
			((UnityEvent)val.GetComponent<Button>().onClick).AddListener(new UnityAction(Close));
		}
	}

	private static Text CreateText(string value, Vector2 position, int fontSize, Color color, float width, float height)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: 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)
		GameObject val = GUIManager.Instance.CreateText(value, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), position, GUIManager.Instance.AveriaSerifBold, fontSize, color, true, Color.black, width, height, false);
		Text component = val.GetComponent<Text>();
		component.alignment = (TextAnchor)4;
		return component;
	}

	private static void Populate(ExchangeMenuMode mode)
	{
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: 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_01a8: Expected O, but got Unknown
		foreach (GameObject tradeButton in TradeButtons)
		{
			Object.Destroy((Object)(object)tradeButton);
		}
		TradeButtons.Clear();
		IReadOnlyList<ExchangeOption> readOnlyList;
		if (mode == ExchangeMenuMode.Materials)
		{
			int activeTier = StatueUpgradeManager.GetActiveTier(_tableStation);
			_title.text = "Ravenwood Material Exchange";
			_subtitle.text = "★ Rank " + (activeTier + 1);
			readOnlyList = ExchangeCatalog.MaterialTrades;
		}
		else
		{
			_title.text = "Ravenwood Coin Exchange";
			_subtitle.text = "Trade upward or break a coin into the next lower denomination";
			readOnlyList = ExchangeCatalog.CoinTrades;
		}
		Vector2 val = default(Vector2);
		for (int i = 0; i < readOnlyList.Count; i++)
		{
			ExchangeOption trade = readOnlyList[i];
			int outputAmount = ((mode == ExchangeMenuMode.Materials) ? StatueUpgradeManager.GetMaterialOutputAmount(trade.OutputPrefab, StatueUpgradeManager.GetActiveTier(_tableStation)) : trade.OutputAmount);
			int num = i % 2;
			int num2 = i / 2;
			((Vector2)(ref val))..ctor((num == 0) ? (-235f) : 235f, 250f - (float)num2 * 53f);
			GameObject val2 = GUIManager.Instance.CreateButton(GetTradeLabel(trade, outputAmount), _panel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), val, 440f, 48f);
			((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				Execute(trade);
			});
			TradeButtons.Add(val2);
		}
	}

	private static void Execute(ExchangeOption trade)
	{
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_player == (Object)null)
		{
			Close();
			return;
		}
		int outputAmount = ((_mode == ExchangeMenuMode.Materials) ? StatueUpgradeManager.GetMaterialOutputAmount(trade.OutputPrefab, StatueUpgradeManager.GetActiveTier(_tableStation)) : trade.OutputAmount);
		string message;
		bool flag = ExchangeService.TryExecute(_player, trade, outputAmount, out message);
		_status.text = message;
		((Graphic)_status).color = (flag ? new Color(0.65f, 1f, 0.65f) : new Color(1f, 0.55f, 0.45f));
		((Character)_player).Message((MessageType)2, message, 0, (Sprite)null);
	}

	private static string GetTradeLabel(ExchangeOption trade, int outputAmount)
	{
		if (_mode != ExchangeMenuMode.Materials || trade.Ingredients.Count == 0)
		{
			return trade.Label;
		}
		string text = ((trade.OutputPrefab == "RWc_Deer") ? "Copper" : ((trade.OutputPrefab == "RWc_Bear") ? "Bronze" : ((trade.OutputPrefab == "RWc_Snake") ? "Iron" : ((trade.OutputPrefab == "RWc_Wolf") ? "Silver" : "Coin"))));
		return "1 " + trade.Ingredients[0].DisplayName + "  →  " + outputAmount + " " + text + ((outputAmount == 1) ? " Coin" : " Coins");
	}
}
internal enum ExchangeMenuMode
{
	Materials,
	Coins
}
internal sealed class ExchangeIngredient
{
	internal string DisplayName { get; }

	internal int Amount { get; }

	internal IReadOnlyList<string> PrefabNames { get; }

	internal ExchangeIngredient(string displayName, int amount, params string[] prefabNames)
	{
		DisplayName = displayName;
		Amount = amount;
		PrefabNames = prefabNames;
	}
}
internal sealed class ExchangeOption
{
	internal string Label { get; }

	internal string OutputPrefab { get; }

	internal int OutputAmount { get; }

	internal IReadOnlyList<ExchangeIngredient> Ingredients { get; }

	internal ExchangeOption(string label, string outputPrefab, int outputAmount, params ExchangeIngredient[] ingredients)
	{
		Label = label;
		OutputPrefab = outputPrefab;
		OutputAmount = outputAmount;
		Ingredients = ingredients;
	}
}
internal static class ExchangeCatalog
{
	internal static readonly IReadOnlyList<ExchangeOption> MaterialTrades = new ExchangeOption[4]
	{
		new ExchangeOption("1 Copper Bar  →  1 Copper Coin", "RWc_Deer", 1, Ingredient("Copper Bar", 1, "Copper")),
		new ExchangeOption("1 Bronze Bar  →  1 Bronze Coin", "RWc_Bear", 1, Ingredient("Bronze Bar", 1, "Bronze")),
		new ExchangeOption("1 Iron Bar  →  1 Iron Coin", "RWc_Snake", 1, Ingredient("Iron Bar", 1, "Iron")),
		new ExchangeOption("1 Silver Bar  →  1 Silver Coin", "RWc_Wolf", 1, Ingredient("Silver Bar", 1, "Silver"))
	};

	internal static readonly IReadOnlyList<ExchangeOption> CoinTrades = new ExchangeOption[20]
	{
		new ExchangeOption("5 Copper  →  1 Bronze", "RWc_Bear", 1, Coin("Copper Coins", 5, "RWc_Deer")),
		new ExchangeOption("10 Copper  →  1 Iron", "RWc_Snake", 1, Coin("Copper Coins", 10, "RWc_Deer")),
		new ExchangeOption("25 Copper  →  1 Silver", "RWc_Wolf", 1, Coin("Copper Coins", 25, "RWc_Deer")),
		new ExchangeOption("100 Copper + 1 Black Metal Bar  →  1 Gold", "RWc_Lion", 1, Coin("Copper Coins", 100, "RWc_Deer"), Ingredient("Black Metal Bar", 1, "BlackMetal")),
		new ExchangeOption("1000 Copper + 1 Flametal Bar  →  1 Mithril", "RWc_Raven", 1, Coin("Copper Coins", 1000, "RWc_Deer"), Ingredient("Flametal Bar", 1, "FlametalNew", "Flametal")),
		new ExchangeOption("2 Bronze  →  1 Iron", "RWc_Snake", 1, Coin("Bronze Coins", 2, "RWc_Bear")),
		new ExchangeOption("5 Bronze  →  1 Silver", "RWc_Wolf", 1, Coin("Bronze Coins", 5, "RWc_Bear")),
		new ExchangeOption("20 Bronze + 1 Black Metal Bar  →  1 Gold", "RWc_Lion", 1, Coin("Bronze Coins", 20, "RWc_Bear"), Ingredient("Black Metal Bar", 1, "BlackMetal")),
		new ExchangeOption("200 Bronze + 1 Flametal Bar  →  1 Mithril", "RWc_Raven", 1, Coin("Bronze Coins", 200, "RWc_Bear"), Ingredient("Flametal Bar", 1, "FlametalNew", "Flametal")),
		new ExchangeOption("5 Iron  →  2 Silver", "RWc_Wolf", 2, Coin("Iron Coins", 5, "RWc_Snake")),
		new ExchangeOption("10 Iron + 1 Black Metal Bar  →  1 Gold", "RWc_Lion", 1, Coin("Iron Coins", 10, "RWc_Snake"), Ingredient("Black Metal Bar", 1, "BlackMetal")),
		new ExchangeOption("100 Iron + 1 Flametal Bar  →  1 Mithril", "RWc_Raven", 1, Coin("Iron Coins", 100, "RWc_Snake"), Ingredient("Flametal Bar", 1, "FlametalNew", "Flametal")),
		new ExchangeOption("4 Silver + 1 Black Metal Bar  →  1 Gold", "RWc_Lion", 1, Coin("Silver Coins", 4, "RWc_Wolf"), Ingredient("Black Metal Bar", 1, "BlackMetal")),
		new ExchangeOption("40 Silver + 1 Flametal Bar  →  1 Mithril", "RWc_Raven", 1, Coin("Silver Coins", 40, "RWc_Wolf"), Ingredient("Flametal Bar", 1, "FlametalNew", "Flametal")),
		new ExchangeOption("10 Gold + 1 Flametal Bar  →  1 Mithril", "RWc_Raven", 1, Coin("Gold Coins", 10, "RWc_Lion"), Ingredient("Flametal Bar", 1, "FlametalNew", "Flametal")),
		new ExchangeOption("1 Mithril  →  10 Gold", "RWc_Lion", 10, Coin("Mithril Coin", 1, "RWc_Raven")),
		new ExchangeOption("1 Gold  →  4 Silver", "RWc_Wolf", 4, Coin("Gold Coin", 1, "RWc_Lion")),
		new ExchangeOption("2 Silver  →  5 Iron", "RWc_Snake", 5, Coin("Silver Coins", 2, "RWc_Wolf")),
		new ExchangeOption("1 Iron  →  2 Bronze", "RWc_Bear", 2, Coin("Iron Coin", 1, "RWc_Snake")),
		new ExchangeOption("1 Bronze  →  5 Copper", "RWc_Deer", 5, Coin("Bronze Coin", 1, "RWc_Bear"))
	};

	private static ExchangeIngredient Ingredient(string displayName, int amount, params string[] prefabNames)
	{
		return new ExchangeIngredient(displayName, amount, prefabNames);
	}

	private static ExchangeIngredient Coin(string displayName, int amount, string prefabName)
	{
		return new ExchangeIngredient(displayName, amount, prefabName);
	}
}
internal static class ExchangeService
{
	private sealed class Removal
	{
		internal ItemData Item;

		internal int Amount;
	}

	private static readonly MethodInfo AddItemDataMethod = typeof(Inventory).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo method) => method.Name == "AddItem" && method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterType == typeof(ItemData));

	private static readonly MethodInfo RemoveItemDataMethod = typeof(Inventory).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonP