Decompiled source of FragileValuables v0.1.5

REPO-FragileValuables.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using REPO_FragileValuables.Config;
using UnityEngine;
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("REPO-FragileValuables")]
[assembly: AssemblyDescription("Mod created by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPO-FragileValuables")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9c40ae3-d0a0-4848-aafc-54ca6693acb0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPO_FragileValuables
{
	[HarmonyPatch]
	public class IncreasedValuableObject : MonoBehaviour
	{
		internal static Random random = null;

		public static Dictionary<Durability, Durability> customDurabilities = new Dictionary<Durability, Durability>();

		public static Dictionary<Value, Value> customValues = new Dictionary<Value, Value>();

		public static HashSet<ValuableObject> currentFragileValuables = new HashSet<ValuableObject>();

		public ValuableObject valuableObject;

		public PhotonView photonView;

		public PhysGrabObjectImpactDetector impactDetector;

		public Durability customDurability;

		public Value customValue;

		public bool increasedFragile = false;

		public bool initialized = false;

		private static bool roundInitialized = false;

		private static int newHaulGoal = 0;

		private static bool modLoadError = false;

		private static FieldInfo dollarValueOriginalField = typeof(ValuableObject).GetField("dollarValueOriginal", BindingFlags.Instance | BindingFlags.Public);

		private static FieldInfo dollarValueCurrentField = typeof(ValuableObject).GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.Public);

		private static FieldInfo dollarValueOriginalPrivateField = typeof(ValuableObject).GetField("dollarValueOriginal", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo dollarValueCurrentPrivateField = typeof(ValuableObject).GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.NonPublic);

		public void Awake()
		{
			valuableObject = ((Component)this).GetComponent<ValuableObject>();
			photonView = ((Component)this).gameObject.GetComponent<PhotonView>();
			impactDetector = ((Component)this).gameObject.GetComponent<PhysGrabObjectImpactDetector>();
		}

		public void Start()
		{
			if (!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient)
			{
				if (random == null)
				{
					random = new Random((int)Time.time);
				}
				if (Object.op_Implicit((Object)(object)valuableObject) && Object.op_Implicit((Object)(object)photonView) && Object.op_Implicit((Object)(object)impactDetector) && (Object)(object)valuableObject.durabilityPreset != (Object)null && (Object)(object)valuableObject.valuePreset != (Object)null && (Object)(object)valuableObject.physAttributePreset != (Object)null && (ConfigSettings.minFragilityThreshold.Value == -1 || valuableObject.durabilityPreset.fragility >= (float)ConfigSettings.minFragilityThreshold.Value) && (ConfigSettings.minValueThreshold.Value == -1 || valuableObject.valuePreset.valueMin >= (float)ConfigSettings.minValueThreshold.Value) && (ConfigSettings.maxValueThreshold.Value == -1 || valuableObject.valuePreset.valueMin <= (float)ConfigSettings.maxValueThreshold.Value) && (ConfigSettings.minMassThreshold.Value == -1 || valuableObject.physAttributePreset.mass >= (float)ConfigSettings.minMassThreshold.Value) && (ConfigSettings.maxMassThreshold.Value == -1 || valuableObject.physAttributePreset.mass <= (float)ConfigSettings.maxMassThreshold.Value))
				{
					float num = (float)random.NextDouble();
					if (num >= 1f - ConfigSettings.fragileValuableChance.Value)
					{
						currentFragileValuables.Add(valuableObject);
						increasedFragile = true;
						initialized = false;
						return;
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)valuableObject) || !currentFragileValuables.Contains(valuableObject))
			{
				((Behaviour)this).enabled = false;
			}
		}

		public void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)valuableObject) && currentFragileValuables.Contains(valuableObject))
			{
				currentFragileValuables.Remove(valuableObject);
			}
		}

		[PunRPC]
		public void IncreaseFragilityRPC()
		{
			IncreaseFragility();
		}

		public void IncreaseFragility()
		{
			if (!Object.op_Implicit((Object)(object)valuableObject) || !Object.op_Implicit((Object)(object)impactDetector) || initialized)
			{
				return;
			}
			if (!customDurabilities.TryGetValue(valuableObject.durabilityPreset, out var value))
			{
				value = Object.Instantiate<Durability>(valuableObject.durabilityPreset);
				((Object)value).name = ((Object)valuableObject.durabilityPreset).name + " Fragile+";
				customDurabilities[valuableObject.durabilityPreset] = value;
			}
			if (!customValues.TryGetValue(valuableObject.valuePreset, out var value2))
			{
				value2 = Object.Instantiate<Value>(valuableObject.valuePreset);
				((Object)value2).name = ((Object)valuableObject.valuePreset).name + " Value+";
				customValues[valuableObject.valuePreset] = value2;
			}
			value.durability = valuableObject.durabilityPreset.durability * 0.01f;
			value.fragility = valuableObject.durabilityPreset.fragility * ConfigSettings.fragilityMultiplier.Value;
			value2.valueMin = valuableObject.valuePreset.valueMin * ConfigSettings.priceMultiplier.Value;
			value2.valueMax = valuableObject.valuePreset.valueMax * ConfigSettings.priceMultiplier.Value;
			if (!ConfigSettings.verboseLogs.Value)
			{
				Plugin.Log("Increasing fragility and value of object: " + ((Object)valuableObject).name);
			}
			Plugin.LogVerbose("Increasing fragility and value of object: " + ((Object)valuableObject).name + " - Fragility: " + valuableObject.durabilityPreset.fragility + " => " + value.fragility + " Durability: " + valuableObject.durabilityPreset.durability + " => " + value.durability + " ValueMin: " + valuableObject.valuePreset.valueMin + " => " + value2.valueMin + " ValueMax: " + valuableObject.valuePreset.valueMax + " => " + value2.valueMax);
			customDurability = value;
			customValue = value2;
			valuableObject.durabilityPreset = value;
			valuableObject.valuePreset = value2;
			impactDetector.fragility = valuableObject.durabilityPreset.fragility;
			impactDetector.durability = valuableObject.durabilityPreset.durability;
			if (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient())
			{
				float num = 0f;
				try
				{
					float num2 = (float)dollarValueOriginalField.GetValue(valuableObject);
					num = (int)(num2 * ConfigSettings.priceMultiplier.Value);
					dollarValueCurrentField.SetValue(valuableObject, num);
				}
				catch
				{
					try
					{
						float num2 = (float)dollarValueOriginalPrivateField.GetValue(valuableObject);
						num = (int)(num2 * ConfigSettings.priceMultiplier.Value);
						dollarValueCurrentPrivateField.SetValue(valuableObject, num);
					}
					catch (Exception ex)
					{
						Plugin.LogError("Something bad happened on this version of REPO. Could not increase fragility of object.\n" + ex);
						return;
					}
				}
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("DollarValueSetRPC", (RpcTarget)0, new object[1] { num });
				}
			}
			increasedFragile = true;
			initialized = true;
			currentFragileValuables.Add(valuableObject);
		}

		[HarmonyPatch(typeof(RoundDirector), "StartRoundLogic")]
		[HarmonyPrefix]
		public static void OnStartRound(ref int value, RoundDirector __instance)
		{
			if (roundInitialized)
			{
				return;
			}
			roundInitialized = true;
			if (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient)
			{
				return;
			}
			IncreasedValuableObject increasedValuableObject = default(IncreasedValuableObject);
			foreach (ValuableObject currentFragileValuable in currentFragileValuables)
			{
				if (!((Component)currentFragileValuable).gameObject.TryGetComponent<IncreasedValuableObject>(ref increasedValuableObject) || !increasedValuableObject.increasedFragile || increasedValuableObject.initialized)
				{
					continue;
				}
				float num;
				try
				{
					num = (float)dollarValueCurrentField.GetValue(currentFragileValuable);
					dollarValueOriginalField.SetValue(currentFragileValuable, num);
				}
				catch
				{
					try
					{
						num = (float)dollarValueCurrentPrivateField.GetValue(currentFragileValuable);
						dollarValueOriginalPrivateField.SetValue(currentFragileValuable, num);
					}
					catch (Exception ex)
					{
						Plugin.LogError("Something bad happened on this version of REPO. Could not initailize mod settings.\n" + ex);
						modLoadError = true;
						return;
					}
				}
				float num2 = num;
				increasedValuableObject.IncreaseFragility();
				if (SemiFunc.IsMultiplayer())
				{
					increasedValuableObject.photonView.RPC("IncreaseFragilityRPC", (RpcTarget)0, Array.Empty<object>());
				}
				float num3 = num;
				if (ConfigSettings.increasedValuesIncreaseGoal.Value && num3 != num2)
				{
					value += (int)(num3 - num2);
				}
			}
			Plugin.Log("Spawned " + currentFragileValuables.Count + " increased fragile valuables." + (ConfigSettings.increasedValuesIncreaseGoal.Value ? (" New goal: " + value) : ""));
		}

		[HarmonyPatch(typeof(ValuableObject), "Awake")]
		[HarmonyPostfix]
		public static void OnAwake(ValuableObject __instance)
		{
			IncreasedValuableObject increasedValuableObject = ((Component)__instance).gameObject.AddComponent<IncreasedValuableObject>();
		}

		[HarmonyPatch(typeof(RoundDirector), "Start")]
		[HarmonyPrefix]
		public static void OnRoundStart(RoundDirector __instance)
		{
			roundInitialized = false;
		}
	}
	[BepInPlugin("flipf17.FragileValuables", "FragileValuables", "0.1.5")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin instance;

		private static ManualLogSource logger;

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			instance = this;
			CreateCustomLogger();
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("FragileValuables");
			PatchAll();
			Log("FragileValuables loaded");
		}

		private void PatchAll()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				_harmony.PatchAll(item);
			}
		}

		private void CreateCustomLogger()
		{
			try
			{
				logger = Logger.CreateLogSource(string.Format("{0}-{1}", "FragileValuables", "0.1.5"));
			}
			catch
			{
				logger = ((BaseUnityPlugin)this).Logger;
			}
		}

		internal static void Log(string message)
		{
			logger.LogInfo((object)message);
		}

		internal static void LogError(string message)
		{
			logger.LogError((object)message);
		}

		internal static void LogWarning(string message)
		{
			logger.LogWarning((object)message);
		}

		internal static void LogVerbose(string message)
		{
			if (ConfigSettings.verboseLogs.Value)
			{
				logger.LogInfo((object)("[VERBOSE] " + message));
			}
		}

		internal static void LogErrorVerbose(string message)
		{
			if (ConfigSettings.verboseLogs.Value)
			{
				logger.LogError((object)("[VERBOSE] " + message));
			}
		}

		internal static void LogWarningVerbose(string message)
		{
			if (ConfigSettings.verboseLogs.Value)
			{
				logger.LogWarning((object)("[VERBOSE] " + message));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "flipf17.FragileValuables";

		public const string PLUGIN_NAME = "FragileValuables";

		public const string PLUGIN_VERSION = "0.1.5";
	}
}
namespace REPO_FragileValuables.UI
{
	[HarmonyPatch]
	public static class ValuableUIPatcher
	{
		internal static readonly Color invalidColor = new Color(0f, 0f, 0f, 0f);

		internal static readonly Color defaultUIColor = new Color(0f, 0.8f, 1f, 1f);

		public static Color uiColorMiddle = defaultUIColor;

		public static Color uiColorMiddleReminder = defaultUIColor;

		public static Color uiColorCorner = defaultUIColor;

		public static Color uiColorPriceText = defaultUIColor;

		public static int displayTime = 2;

		public static float minAlpha = 0.05f;

		public static float maxAlpha = 0.5f;

		public static int flashSpeed = 1;

		private static Color previousTextUIColor;

		internal static Dictionary<ValuableDiscoverGraphic, Image> middleImages = new Dictionary<ValuableDiscoverGraphic, Image>();

		[HarmonyPatch(typeof(LevelGenerator), "Start")]
		[HarmonyPrefix]
		public static void OnLevelGenerationStart()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			middleImages.Clear();
			Color val = default(Color);
			if (!ColorUtility.TryParseHtmlString("#" + ConfigSettings.fragileUIColor.Value.Trim(new char[1] { ' ' }).TrimStart(new char[1] { '#' }), ref val))
			{
				val = defaultUIColor;
				Plugin.LogError("Failed to parse UI color hex: " + ConfigSettings.fragileUIColor.Value + ". Using default color.");
			}
			uiColorMiddle = new Color(val.r, val.g, val.b, 0.1f);
			uiColorCorner = new Color(val.r, val.g, val.b, 0.8f);
			uiColorPriceText = new Color(val.r, val.g, val.b, 1f);
		}

		[HarmonyPatch(typeof(ValuableDiscoverGraphic), "Start")]
		[HarmonyPrefix]
		public static void OnStart(ref State ___state, ValuableDiscoverGraphic __instance)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			if ((___state && (int)___state != 1) || !ConfigSettings.useCustomUIColor.Value)
			{
				return;
			}
			PhysGrabObject target = __instance.target;
			ValuableObject component = ((Component)target).GetComponent<ValuableObject>();
			if (!Object.op_Implicit((Object)(object)component) || !IncreasedValuableObject.currentFragileValuables.Contains(component))
			{
				return;
			}
			__instance.waitTime = displayTime;
			__instance.colorDiscoverMiddle = uiColorMiddle;
			__instance.colorDiscoverCorner = uiColorCorner;
			__instance.ColorReminderMiddle = new Color(uiColorMiddle.r, uiColorMiddle.g, uiColorMiddle.b, uiColorMiddle.a / 2f);
			__instance.ColorReminderCorner = uiColorCorner;
			RectTransform middle = __instance.middle;
			Image val = ((middle != null) ? ((Component)middle).GetComponent<Image>() : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				((Graphic)val).color = uiColorMiddle;
				middleImages[__instance] = val;
			}
			else
			{
				Plugin.LogError("Failed to modify fragile valuable's ValuableDiscoverGraphic UI (middle) color.");
			}
			Image[] array = new Image[4];
			RectTransform topLeft = __instance.topLeft;
			array[0] = ((topLeft != null) ? ((Component)topLeft).GetComponent<Image>() : null);
			RectTransform topRight = __instance.topRight;
			array[1] = ((topRight != null) ? ((Component)topRight).GetComponent<Image>() : null);
			RectTransform botLeft = __instance.botLeft;
			array[2] = ((botLeft != null) ? ((Component)botLeft).GetComponent<Image>() : null);
			RectTransform botRight = __instance.botRight;
			array[3] = ((botRight != null) ? ((Component)botRight).GetComponent<Image>() : null);
			Image[] array2 = (Image[])(object)array;
			for (int i = 0; i < array2.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)array2[i]))
				{
					((Graphic)array2[i]).color = uiColorCorner;
				}
				else
				{
					Plugin.LogError("Failed to modify fragile valuable's ValuableDiscoverGraphic UI (corner at index " + i + ") color.");
				}
			}
		}

		[HarmonyPatch(typeof(ValuableDiscoverGraphic), "Update")]
		[HarmonyPostfix]
		public static void UpdateAlpha(ref State ___state, ref float ___waitTimer, ValuableDiscoverGraphic __instance)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (((int)___state == 0 || (int)___state == 1) && middleImages.TryGetValue(__instance, out var value))
			{
				float num = __instance.waitTime - ___waitTimer;
				float num2 = Mathf.Sin(2f * (num - 1f / (4f * (float)flashSpeed)) * (float)Math.PI * (float)flashSpeed) / 2f * (maxAlpha - minAlpha) + (maxAlpha + minAlpha) / 2f;
				float num3 = Mathf.Lerp(((Graphic)value).color.a, num2, 15f * Time.deltaTime);
				((Graphic)value).color = new Color(((Graphic)value).color.r, ((Graphic)value).color.g, ((Graphic)value).color.b, num3);
			}
		}

		[HarmonyPatch(typeof(WorldSpaceUIValue), "Show")]
		[HarmonyPrefix]
		public static void OnShowValuePrefix(ref PhysGrabObject ___currentPhysGrabObject, PhysGrabObject _grabObject, int _value, bool _cost, Vector3 _offset, WorldSpaceUIValue __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (!ConfigSettings.useCustomUIColor.Value)
			{
				return;
			}
			previousTextUIColor = __instance.colorValue;
			if (!((Object.op_Implicit((Object)(object)___currentPhysGrabObject) && (Object)(object)___currentPhysGrabObject != (Object)(object)_grabObject) || _cost))
			{
				ValuableObject component = ((Component)_grabObject).GetComponent<ValuableObject>();
				if (Object.op_Implicit((Object)(object)component) && IncreasedValuableObject.currentFragileValuables.Contains(component))
				{
					__instance.colorValue = uiColorPriceText;
				}
			}
		}

		[HarmonyPatch(typeof(WorldSpaceUIValue), "Show")]
		[HarmonyPostfix]
		public static void OnShowValuePostfix(PhysGrabObject _grabObject, int _value, bool _cost, Vector3 _offset, WorldSpaceUIValue __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigSettings.useCustomUIColor.Value)
			{
				__instance.colorValue = previousTextUIColor;
			}
		}
	}
}
namespace REPO_FragileValuables.Config
{
	[Serializable]
	public static class ConfigSettings
	{
		public static ConfigEntry<float> fragileValuableChance;

		public static ConfigEntry<float> fragilityMultiplier;

		public static ConfigEntry<float> priceMultiplier;

		public static ConfigEntry<bool> increasedValuesIncreaseGoal;

		public static ConfigEntry<int> minFragilityThreshold;

		public static ConfigEntry<int> minValueThreshold;

		public static ConfigEntry<int> maxValueThreshold;

		public static ConfigEntry<int> minMassThreshold;

		public static ConfigEntry<int> maxMassThreshold;

		public static ConfigEntry<bool> useCustomUIColor;

		public static ConfigEntry<string> fragileUIColor;

		public static ConfigEntry<bool> verboseLogs;

		public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>();

		internal static void BindConfigSettings()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Expected O, but got Unknown
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Expected O, but got Unknown
			Plugin.Log("Binding Configs");
			fragilityMultiplier = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Increased Fragility Multiplier", 3f, new ConfigDescription("[Host only] Higher value = More fragile. The more fragile an object, the easier it is to damage it. A value of 1 would not modify the fragility. (lighter hits may cause damage)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())));
			priceMultiplier = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Increased Price Multiplier", 2f, new ConfigDescription("[Host only] Price multiplier for fragile valuables. This only affects the objects randomly spawned with increased fragility. A value of 1 would not modify the price.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())));
			increasedValuesIncreaseGoal = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Increased Values Increases Goal", true, new ConfigDescription("[Host only] Vanilla behavior = true. If true, the extra value from increased fragile objects will increase the required extraction goal.", (AcceptableValueBase)null, Array.Empty<object>())));
			fragileValuableChance = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Spawn Rules", "Increased Fragility Chance", 0.1f, new ConfigDescription("[Host only] Chance for a fragile valuable to spawn with more value, but higher fragility.\nValues will be clamped between 0.01 and 1.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>())));
			minFragilityThreshold = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Spawn Rules", "Min Fragility - Threshold", 90, new ConfigDescription("[Host only] Only objects with a default fragility of this number and ABOVE will have a chance to increase in fragility and value.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())));
			minValueThreshold = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Spawn Rules", "Min Value - Threshold", 1000, new ConfigDescription("[Host only] Only objects with a default min value of this number and ABOVE will have a chance to increase in fragility and value.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100000), Array.Empty<object>())));
			maxValueThreshold = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Spawn Rules", "Max Value - Threshold", 5000, new ConfigDescription("[Host only] Only objects with a default min value of this number and BELOW will have a chance to increase in fragility and value.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100000), Array.Empty<object>())));
			minMassThreshold = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Spawn Rules", "Min Mass - Threshold", 0, new ConfigDescription("[Host only] Only objects with a default mass of this number and ABOVE will have a chance to increase in fragility and value. (for reference a small vase has a mass of 2)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())));
			maxMassThreshold = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Spawn Rules", "Max Mass - Threshold", 2, new ConfigDescription("[Host only] Only objects with a default mass of this number and BELOW will have a chance to increase in fragility and value. (for reference a small vase has a mass of 2)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())));
			useCustomUIColor = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("UI", "Use Custom UI Color", true, new ConfigDescription("[Client-side] If true, the custom ui color for increased fragile object will apply.\nThese colors are used when discovering an increased fragile object, or for the value color while holding the object.", (AcceptableValueBase)null, Array.Empty<object>())));
			fragileUIColor = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("UI", "Discovered Object UI Color HEX", "00CCFF", new ConfigDescription("[Client-side] 6 character hex color value. (no alpha) Default: \"00CCFF\"", (AcceptableValueBase)null, Array.Empty<object>())));
			verboseLogs = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Verbose Logs", false, new ConfigDescription("Enables verbose logs. Useful for debugging.", (AcceptableValueBase)null, Array.Empty<object>())));
			fragilityMultiplier.Value = Mathf.Clamp(fragilityMultiplier.Value, 0.1f, 5f);
			priceMultiplier.Value = Mathf.Max(priceMultiplier.Value, 0.1f);
			fragileValuableChance.Value = Mathf.Clamp(fragileValuableChance.Value, 0f, 1f);
			minFragilityThreshold.Value = Mathf.Clamp(minFragilityThreshold.Value, 0, 100);
			minValueThreshold.Value = Mathf.Clamp(minValueThreshold.Value, 0, 100000);
			maxValueThreshold.Value = Mathf.Clamp(maxValueThreshold.Value, minValueThreshold.Value, 100000);
			minMassThreshold.Value = Mathf.Clamp(minMassThreshold.Value, 0, 10);
			maxMassThreshold.Value = Mathf.Clamp(maxMassThreshold.Value, minMassThreshold.Value, 10);
		}

		internal static ConfigEntry<T> AddConfigEntry<T>(ConfigEntry<T> configEntry)
		{
			currentConfigEntries.Add(((ConfigEntryBase)configEntry).Definition.Key, (ConfigEntryBase)(object)configEntry);
			return configEntry;
		}
	}
}