Decompiled source of vinestweaks v0.4.0

vinestweaks.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("VGMWorld")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds Risk of Rain 2 artifacts and some other challenging tweaks. Highly configurable.")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyInformationalVersion("0.4.0")]
[assembly: AssemblyProduct("vinestweaks")]
[assembly: AssemblyTitle("vinestweaks")]
[assembly: AssemblyVersion("0.4.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace VGMWorld.RiskOfRain2.VinesTweaks
{
	[BepInPlugin("com.vgmworld.vinestweaks", "VinesTweaks", "0.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("Risk of Rain 2.exe")]
	public sealed class VinesTweaksPlugin : BaseUnityPlugin
	{
		private struct DamageBudget
		{
			public float WindowStart;

			public float DamageUsed;
		}

		private struct UndyingState
		{
			public float ExpireTime;

			public float NextPulseTime;

			public CharacterBody Body;
		}

		private struct SurvivalInstinctState
		{
			public float ExpireTime;

			public float CooldownUntil;

			public CharacterBody Body;
		}

		private enum ArtifactGlyph
		{
			RewardingVines,
			Recalibration,
			Undying,
			SurvivalInstinct,
			ScrappyBeginnings,
			Escalation
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Action<Run> <0>__OnRunStartGlobal;

			public static Action<DamageReport> <1>__OnCharacterDeathGlobal;

			public static StatHookEventHandler <2>__OnGetStatCoefficients;

			public static hook_TakeDamage <3>__OnTakeDamage;

			public static hook_OnHitEnemy <4>__OnHitEnemy;

			public static hook_OnInteractionBegin <5>__OnPurchaseInteractionBegin;
		}

		public const string PluginGuid = "com.vgmworld.vinestweaks";

		public const string PluginName = "VinesTweaks";

		public const string PluginVersion = "0.4.0";

		private const string RewardingVinesArtifactToken = "VINESTWEAKS_REWARDING_VINES";

		private const string RewardingVinesArtifactNameToken = "ARTIFACT_VINESTWEAKS_REWARDING_VINES_NAME";

		private const string RewardingVinesArtifactDescriptionToken = "ARTIFACT_VINESTWEAKS_REWARDING_VINES_DESCRIPTION";

		private const string RewardingVinesWhiteRewardChatToken = "VINESTWEAKS_REWARDING_VINES_WHITE_REWARD_CHAT";

		private const string RewardingVinesRedRewardChatToken = "VINESTWEAKS_REWARDING_VINES_RED_REWARD_CHAT";

		private const string BloodTitheRewardChatToken = "VINESTWEAKS_BLOOD_TITHE_REWARD_CHAT";

		private const string BloodInsuranceChatToken = "VINESTWEAKS_BLOOD_INSURANCE_CHAT";

		private const string RecalibrationArtifactToken = "VINESTWEAKS_RECALIBRATION";

		private const string RecalibrationArtifactNameToken = "ARTIFACT_VINESTWEAKS_RECALIBRATION_NAME";

		private const string RecalibrationArtifactDescriptionToken = "ARTIFACT_VINESTWEAKS_RECALIBRATION_DESCRIPTION";

		private const string UndyingArtifactToken = "VINESTWEAKS_UNDYING";

		private const string UndyingArtifactNameToken = "ARTIFACT_VINESTWEAKS_UNDYING_NAME";

		private const string UndyingArtifactDescriptionToken = "ARTIFACT_VINESTWEAKS_UNDYING_DESCRIPTION";

		private const string UndyingBuffToken = "VINESTWEAKS_UNDYING_BUFF";

		private const string UndyingBuffNameToken = "VINESTWEAKS_UNDYING_BUFF_NAME";

		private const string SurvivalInstinctArtifactToken = "VINESTWEAKS_SURVIVAL_INSTINCT";

		private const string SurvivalInstinctArtifactNameToken = "ARTIFACT_VINESTWEAKS_SURVIVAL_INSTINCT_NAME";

		private const string SurvivalInstinctArtifactDescriptionToken = "ARTIFACT_VINESTWEAKS_SURVIVAL_INSTINCT_DESCRIPTION";

		private const string ScrappyBeginningsArtifactToken = "VINESTWEAKS_SCRAPPY_BEGINNINGS";

		private const string ScrappyBeginningsArtifactNameToken = "ARTIFACT_VINESTWEAKS_SCRAPPY_BEGINNINGS_NAME";

		private const string ScrappyBeginningsArtifactDescriptionToken = "ARTIFACT_VINESTWEAKS_SCRAPPY_BEGINNINGS_DESCRIPTION";

		private const string EscalationArtifactToken = "VINESTWEAKS_ESCALATION";

		private const string EscalationArtifactNameToken = "ARTIFACT_VINESTWEAKS_ESCALATION_NAME";

		private const string EscalationArtifactDescriptionToken = "ARTIFACT_VINESTWEAKS_ESCALATION_DESCRIPTION";

		private const string GChickenBoosterItemToken = "VINESTWEAKS_G_CHICKEN_BOOSTER";

		private const string GChickenBoosterNameToken = "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_NAME";

		private const string GChickenBoosterPickupToken = "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_PICKUP";

		private const string GChickenBoosterDescriptionToken = "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_DESCRIPTION";

		private const string GChickenBoosterLoreToken = "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_LORE";

		private const string DeflectiveYolkItemToken = "VINESTWEAKS_DEFLECTIVE_YOLK";

		private const string DeflectiveYolkNameToken = "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_NAME";

		private const string DeflectiveYolkPickupToken = "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_PICKUP";

		private const string DeflectiveYolkDescriptionToken = "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_DESCRIPTION";

		private const string DeflectiveYolkLoreToken = "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_LORE";

		private static ArtifactDef? rewardingVinesArtifact;

		private static ArtifactDef? recalibrationArtifact;

		private static ArtifactDef? undyingArtifact;

		private static ArtifactDef? survivalInstinctArtifact;

		private static ArtifactDef? scrappyBeginningsArtifact;

		private static ArtifactDef? escalationArtifact;

		private static ItemDef? gChickenBoosterItem;

		private static ItemDef? deflectiveYolkItem;

		private static ConfigEntry<float>? monsterDropChance;

		private static ConfigEntry<float>? eliteDropChance;

		private static ConfigEntry<float>? bossExtraDropChance;

		private static ConfigEntry<int>? earlyWhiteLevelCount;

		private static ConfigEntry<float>? earlyWhiteDropChance;

		private static ConfigEntry<int>? redTierLevelThreshold;

		private static ConfigEntry<float>? redTierDropChance;

		private static ConfigEntry<float>? commonTierWeight;

		private static ConfigEntry<float>? uncommonTierWeight;

		private static ConfigEntry<float>? legendaryTierWeight;

		private static ConfigEntry<float>? dropUpVelocity;

		private static ConfigEntry<float>? dropSideVelocity;

		private static ConfigEntry<int>? maxRewardingVinesKillDropsPerSecond;

		private static ConfigEntry<float>? visualEffectThrottleSeconds;

		private static ConfigEntry<float>? commonDirectDamageCap;

		private static ConfigEntry<float>? eliteDirectDamageCap;

		private static ConfigEntry<float>? bossDirectDamageCap;

		private static ConfigEntry<float>? procDamageMultiplier;

		private static ConfigEntry<float>? procDamageCap;

		private static ConfigEntry<float>? damageBudgetWindow;

		private static ConfigEntry<bool>? showRecalibrationEffect;

		private static ConfigEntry<float>? commonUndyingSeconds;

		private static ConfigEntry<float>? eliteUndyingSeconds;

		private static ConfigEntry<float>? bossUndyingSeconds;

		private static ConfigEntry<float>? undyingPulseInterval;

		private static ConfigEntry<bool>? showUndyingEffect;

		private static ConfigEntry<float>? survivalCommonTriggerPercent;

		private static ConfigEntry<float>? survivalEliteTriggerPercent;

		private static ConfigEntry<float>? survivalBossTriggerPercent;

		private static ConfigEntry<float>? survivalDamageReductionPercent;

		private static ConfigEntry<float>? survivalDurationSeconds;

		private static ConfigEntry<float>? survivalCooldownSeconds;

		private static ConfigEntry<bool>? showSurvivalInstinctEffect;

		private static ConfigEntry<int>? scrappyProtectedStages;

		private static ConfigEntry<float>? scrappyDamageReductionPercent;

		private static ConfigEntry<bool>? showScrappyEffect;

		private static ConfigEntry<int>? escalationStartStage;

		private static ConfigEntry<float>? escalationDamageReductionPerStagePercent;

		private static ConfigEntry<float>? escalationEliteBonusPercent;

		private static ConfigEntry<float>? escalationBossBonusPercent;

		private static ConfigEntry<float>? escalationMaximumReductionPercent;

		private static ConfigEntry<bool>? showEscalationEffect;

		private static ConfigEntry<bool>? sanguineBargainsEnabled;

		private static ConfigEntry<float>? bloodTitheThresholdPercent;

		private static ConfigEntry<float>? bloodTitheRewardChancePercent;

		private static ConfigEntry<float>? bloodTitheGreenChancePercent;

		private static ConfigEntry<float>? bloodTitheRedChancePercent;

		private static ConfigEntry<int>? maxBloodTitheRewardsPerUse;

		private static ConfigEntry<bool>? bloodInsuranceEnabled;

		private static ConfigEntry<float>? bloodInsuranceHealthThresholdPercent;

		private static ConfigEntry<float>? bloodInsuranceBarrierPercent;

		private static ConfigEntry<bool>? showSanguineBargainsEffect;

		private static ConfigEntry<bool>? enableVinesTweaksItems;

		private static ConfigEntry<float>? gChickenBoosterCritChanceBase;

		private static ConfigEntry<float>? gChickenBoosterCritChanceStack;

		private static ConfigEntry<float>? gChickenBoosterCritDamageBase;

		private static ConfigEntry<float>? gChickenBoosterCritDamageStack;

		private static ConfigEntry<float>? deflectiveYolkCritChanceBase;

		private static ConfigEntry<float>? deflectiveYolkCritChanceStack;

		private static ConfigEntry<float>? deflectiveYolkBarrierBase;

		private static ConfigEntry<float>? deflectiveYolkBarrierStack;

		private static ConfigEntry<float>? deflectiveYolkBarrierCooldown;

		private static ConfigEntry<bool>? debugLogging;

		private static int lastRewardedWhiteLevel;

		private static int lastRewardedRedTierMilestone;

		private static VinesTweaksPlugin? instance;

		private static GameObject? recalibrationImpactEffectPrefab;

		private static GameObject? damageRejectedEffectPrefab;

		private static GameObject? undyingPulseEffectPrefab;

		private static GameObject? survivalInstinctEffectPrefab;

		private static GameObject? scrappyBeginningsEffectPrefab;

		private static GameObject? escalationEffectPrefab;

		private static GameObject? sanguineBargainsEffectPrefab;

		private static BuffDef? undyingImmuneBuffDef;

		private static BuffDef? undyingVisibleBuffDef;

		private static bool forcingUndyingDeath;

		private static float rewardingVinesKillDropWindowStart;

		private static int rewardingVinesKillDropsInWindow;

		private static float nextVisualEffectTime;

		private static readonly Dictionary<HealthComponent, DamageBudget> recalibrationBudgets = new Dictionary<HealthComponent, DamageBudget>();

		private static readonly Dictionary<HealthComponent, UndyingState> undyingMonsters = new Dictionary<HealthComponent, UndyingState>();

		private static readonly HashSet<HealthComponent> spentUndyingMonsters = new HashSet<HealthComponent>();

		private static readonly Dictionary<HealthComponent, SurvivalInstinctState> survivalInstinctMonsters = new Dictionary<HealthComponent, SurvivalInstinctState>();

		private static readonly Dictionary<CharacterMaster, float> bloodTitheProgress = new Dictionary<CharacterMaster, float>();

		private static readonly Dictionary<CharacterBody, float> deflectiveYolkCooldowns = new Dictionary<CharacterBody, float>();

		private static readonly List<HealthComponent> undyingBuffer = new List<HealthComponent>();

		private static readonly List<HealthComponent> survivalInstinctBuffer = new List<HealthComponent>();

		private void Awake()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_009a: 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)
			//IL_00a5: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			instance = this;
			CreateConfig();
			RegisterRiskOfOptions();
			RegisterArtifacts();
			RegisterItems();
			EnsureVisualEffectPrefabs();
			undyingImmuneBuffDef = Buffs.Immune;
			Run.onRunStartGlobal += OnRunStartGlobal;
			GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeathGlobal;
			object obj = <>O.<2>__OnGetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val = OnGetStatCoefficients;
				<>O.<2>__OnGetStatCoefficients = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			object obj2 = <>O.<3>__OnTakeDamage;
			if (obj2 == null)
			{
				hook_TakeDamage val2 = OnTakeDamage;
				<>O.<3>__OnTakeDamage = val2;
				obj2 = (object)val2;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj2;
			object obj3 = <>O.<4>__OnHitEnemy;
			if (obj3 == null)
			{
				hook_OnHitEnemy val3 = OnHitEnemy;
				<>O.<4>__OnHitEnemy = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj3;
			object obj4 = <>O.<5>__OnPurchaseInteractionBegin;
			if (obj4 == null)
			{
				hook_OnInteractionBegin val4 = OnPurchaseInteractionBegin;
				<>O.<5>__OnPurchaseInteractionBegin = val4;
				obj4 = (object)val4;
			}
			PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj4;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"VinesTweaks loaded. Enable any VinesTweaks artifact to activate its effect.");
		}

		private void OnDestroy()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			Run.onRunStartGlobal -= OnRunStartGlobal;
			GlobalEventManager.onCharacterDeathGlobal -= OnCharacterDeathGlobal;
			object obj = <>O.<2>__OnGetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val = OnGetStatCoefficients;
				<>O.<2>__OnGetStatCoefficients = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj;
			object obj2 = <>O.<3>__OnTakeDamage;
			if (obj2 == null)
			{
				hook_TakeDamage val2 = OnTakeDamage;
				<>O.<3>__OnTakeDamage = val2;
				obj2 = (object)val2;
			}
			HealthComponent.TakeDamage -= (hook_TakeDamage)obj2;
			object obj3 = <>O.<4>__OnHitEnemy;
			if (obj3 == null)
			{
				hook_OnHitEnemy val3 = OnHitEnemy;
				<>O.<4>__OnHitEnemy = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnHitEnemy -= (hook_OnHitEnemy)obj3;
			object obj4 = <>O.<5>__OnPurchaseInteractionBegin;
			if (obj4 == null)
			{
				hook_OnInteractionBegin val4 = OnPurchaseInteractionBegin;
				<>O.<5>__OnPurchaseInteractionBegin = val4;
				obj4 = (object)val4;
			}
			PurchaseInteraction.OnInteractionBegin -= (hook_OnInteractionBegin)obj4;
			instance = null;
		}

		private void FixedUpdate()
		{
			TryDropRewardingVinesLevelRewards();
			if (!NetworkServer.active || undyingMonsters.Count == 0)
			{
				CleanupSurvivalInstinctStates();
				return;
			}
			undyingBuffer.Clear();
			foreach (KeyValuePair<HealthComponent, UndyingState> undyingMonster in undyingMonsters)
			{
				undyingBuffer.Add(undyingMonster.Key);
			}
			foreach (HealthComponent item in undyingBuffer)
			{
				if (!Object.op_Implicit((Object)(object)item) || !undyingMonsters.TryGetValue(item, out var value))
				{
					undyingMonsters.Remove(item);
					continue;
				}
				CharacterBody val = (CharacterBody)(Object.op_Implicit((Object)(object)value.Body) ? ((object)value.Body) : ((object)item.body));
				if (!Object.op_Implicit((Object)(object)val) || !item.alive)
				{
					RemoveUndyingBuff(val);
					undyingMonsters.Remove(item);
					continue;
				}
				ConfigEntry<bool>? obj = showUndyingEffect;
				if (obj != null && obj.Value && Time.time >= value.NextPulseTime)
				{
					SpawnUndyingPulse(val);
					value.NextPulseTime = Time.time + Mathf.Max(0.05f, undyingPulseInterval.Value);
					undyingMonsters[item] = value;
				}
				if (Time.time >= value.ExpireTime)
				{
					undyingMonsters.Remove(item);
					RemoveUndyingBuff(val);
					ForceKillUndyingMonster(item, val);
				}
			}
			CleanupSurvivalInstinctStates();
		}

		private void CreateConfig()
		{
			monsterDropChance = ((BaseUnityPlugin)this).Config.Bind<float>("Rewarding Vines", "Monster drop chance percent", 0.3f, "Percent chance for a non-elite, non-boss monster kill to drop a normal weighted item while the artifact is enabled.");
			eliteDropChance = ((BaseUnityPlugin)this).Config.Bind<float>("Rewarding Vines", "Elite drop chance percent", 1f, "Percent chance for an elite monster kill to drop a normal weighted item while the artifact is enabled.");
			bossExtraDropChance = ((BaseUnityPlugin)this).Config.Bind<float>("Rewarding Vines", "Boss extra drop chance percent", 10f, "Percent chance for a boss/champion monster kill to drop an extra normal weighted item while the artifact is enabled.");
			earlyWhiteLevelCount = ((BaseUnityPlugin)this).Config.Bind<int>("Rewarding Vines", "Early white item level count", 5, "First N player team level-ups that grant a white-tier item while the artifact is enabled. Set to 0 to disable.");
			earlyWhiteDropChance = ((BaseUnityPlugin)this).Config.Bind<float>("Rewarding Vines", "Early white item chance percent", 100f, "Percent chance to drop a white-tier item for each early player team level reward.");
			redTierLevelThreshold = ((BaseUnityPlugin)this).Config.Bind<int>("Rewarding Vines", "Player level red tier threshold", 25, "Player team level required before the red tier drop roll can happen.");
			redTierDropChance = ((BaseUnityPlugin)this).Config.Bind<float>("Rewarding Vines", "Red tier milestone chance percent", 100f, "Percent chance to drop a red-tier item when the player team reaches each configured level milestone.");
			commonTierWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Item Tier Weights", "Common tier weight", 79f, "Relative weight for common items when a normal weighted item drops.");
			uncommonTierWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Item Tier Weights", "Uncommon tier weight", 20f, "Relative weight for uncommon items when a normal weighted item drops.");
			legendaryTierWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Item Tier Weights", "Legendary tier weight", 1f, "Relative weight for legendary items when a normal weighted item drops.");
			dropUpVelocity = ((BaseUnityPlugin)this).Config.Bind<float>("Drop Physics", "Upward drop velocity", 20f, "Vertical launch velocity for item drops.");
			dropSideVelocity = ((BaseUnityPlugin)this).Config.Bind<float>("Drop Physics", "Side drop velocity", 5f, "Sideways launch velocity for item drops.");
			maxRewardingVinesKillDropsPerSecond = ((BaseUnityPlugin)this).Config.Bind<int>("Safety Limits", "Max Rewarding Vines kill drops per second", 8, "Maximum random monster-kill item drops Artifact of Rewarding Vines can create per real-time second. Milestone, Blood Tithe, and other direct rewards are not counted.");
			visualEffectThrottleSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Safety Limits", "Visual effect throttle seconds", 0.08f, "Minimum seconds between non-essential VinesTweaks visual feedback effects. Set to 0 to disable throttling.");
			commonDirectDamageCap = ((BaseUnityPlugin)this).Config.Bind<float>("Recalibration", "Common direct damage cap", 0.5f, "Maximum fraction of a common monster's max health that one direct player hit can remove.");
			eliteDirectDamageCap = ((BaseUnityPlugin)this).Config.Bind<float>("Recalibration", "Elite direct damage cap", 0.15f, "Maximum fraction of an elite monster's max health that one direct player hit can remove.");
			bossDirectDamageCap = ((BaseUnityPlugin)this).Config.Bind<float>("Recalibration", "Boss direct damage cap", 0.03f, "Maximum fraction of a boss/champion monster's max health that one direct player hit can remove.");
			procDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Recalibration", "Passive proc damage multiplier", 0.15f, "Damage multiplier for low-proc-coefficient item chains while Artifact of Recalibration is enabled.");
			procDamageCap = ((BaseUnityPlugin)this).Config.Bind<float>("Recalibration", "Passive proc damage cap", 0.02f, "Maximum fraction of a monster's max health that one passive proc-chain hit can remove.");
			damageBudgetWindow = ((BaseUnityPlugin)this).Config.Bind<float>("Recalibration", "Direct damage budget window seconds", 0.1f, "Short per-target window where rapid direct hits share the same damage cap budget.");
			showRecalibrationEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Recalibration", "Show recalibration impact effect", true, "Show a distinct impact effect when Artifact of Recalibration reduces incoming damage.");
			commonUndyingSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Undying", "Common undying seconds", 1.5f, "Seconds a common monster remains alive and immune at 1 HP after taking lethal damage.");
			eliteUndyingSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Undying", "Elite undying seconds", 4f, "Seconds an elite monster remains alive and immune at 1 HP after taking lethal damage.");
			bossUndyingSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Undying", "Boss undying seconds", 8f, "Seconds a boss/champion monster remains alive and immune at 1 HP after taking lethal damage.");
			undyingPulseInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Undying", "Undying visual pulse interval seconds", 0.35f, "Seconds between visual pulses on monsters during their undying immune period.");
			showUndyingEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Undying", "Show undying visual effect", true, "Show repeated visual pulses while a monster is in its undying immune period.");
			survivalCommonTriggerPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Survival Instinct", "Common trigger damage percent", 35f, "Percent of max health a common monster must take in one hit before gaining temporary damage resistance.");
			survivalEliteTriggerPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Survival Instinct", "Elite trigger damage percent", 20f, "Percent of max health an elite monster must take in one hit before gaining temporary damage resistance.");
			survivalBossTriggerPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Survival Instinct", "Boss trigger damage percent", 8f, "Percent of max health a boss/champion monster must take in one hit before gaining temporary damage resistance.");
			survivalDamageReductionPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Survival Instinct", "Damage reduction percent", 45f, "Percent of incoming damage prevented while Survival Instinct is active.");
			survivalDurationSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Survival Instinct", "Resistance duration seconds", 1.25f, "Seconds temporary damage resistance lasts after Survival Instinct triggers.");
			survivalCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Survival Instinct", "Per monster cooldown seconds", 4f, "Seconds before the same monster can trigger Survival Instinct again.");
			showSurvivalInstinctEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Survival Instinct", "Show survival instinct effect", true, "Show a defensive flash when Survival Instinct reduces damage or activates.");
			scrappyProtectedStages = ((BaseUnityPlugin)this).Config.Bind<int>("Scrappy Beginnings", "Protected stage count", 2, "Number of early stages where players receive damage reduction.");
			scrappyDamageReductionPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Scrappy Beginnings", "Player damage reduction percent", 20f, "Percent of incoming player damage prevented during protected early stages.");
			showScrappyEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrappy Beginnings", "Show scrappy protection effect", false, "Show a defensive flash when Scrappy Beginnings reduces player damage.");
			escalationStartStage = ((BaseUnityPlugin)this).Config.Bind<int>("Escalation", "Start stage", 5, "One-based stage number where Artifact of Escalation begins reducing damage dealt to monsters.");
			escalationDamageReductionPerStagePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Escalation", "Damage reduction per stage percent", 3f, "Additional monster damage reduction gained per stage after escalation starts.");
			escalationEliteBonusPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Escalation", "Elite bonus reduction percent", 5f, "Extra damage reduction for elites after escalation starts.");
			escalationBossBonusPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Escalation", "Boss bonus reduction percent", 12f, "Extra damage reduction for bosses/champions after escalation starts.");
			escalationMaximumReductionPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Escalation", "Maximum reduction percent", 60f, "Maximum total damage reduction Artifact of Escalation can apply.");
			showEscalationEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Escalation", "Show escalation effect", true, "Show an impact flash when Artifact of Escalation reduces damage.");
			sanguineBargainsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sanguine Bargains", "Enable blood shrine tweak", true, "Enable extra Blood Shrine rewards and optional low-health insurance.");
			bloodTitheThresholdPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Sanguine Bargains", "Blood tithe threshold percent", 50f, "Cumulative percent of max health sacrificed at Blood Shrines before a reward roll is earned.");
			bloodTitheRewardChancePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Sanguine Bargains", "Blood tithe reward chance percent", 100f, "Percent chance to drop an item each time the Blood Tithe threshold is reached.");
			bloodTitheGreenChancePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Sanguine Bargains", "Blood tithe green chance percent", 25f, "Percent chance for a Blood Tithe reward to use the green item drop list instead of white.");
			bloodTitheRedChancePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Sanguine Bargains", "Blood tithe red chance percent", 2f, "Percent chance for a Blood Tithe reward to use the red item drop list instead of white or green.");
			maxBloodTitheRewardsPerUse = ((BaseUnityPlugin)this).Config.Bind<int>("Sanguine Bargains", "Max Blood Tithe rewards per shrine use", 3, "Maximum Blood Tithe item rewards one Blood Shrine interaction can create. Excess progress is discarded to prevent item bursts from extreme config values.");
			bloodInsuranceEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sanguine Bargains", "Enable blood insurance barrier", true, "Grant temporary barrier if a Blood Shrine leaves the player below the configured health threshold.");
			bloodInsuranceHealthThresholdPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Sanguine Bargains", "Insurance health threshold percent", 55f, "Combined health percent at or below which Blood Insurance grants barrier after using a Blood Shrine.");
			bloodInsuranceBarrierPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Sanguine Bargains", "Insurance barrier percent", 25f, "Barrier granted as a percent of max combined health after Blood Insurance triggers.");
			showSanguineBargainsEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Sanguine Bargains", "Show sanguine bargains effect", true, "Show a small impact effect when Sanguine Bargains grants a reward or barrier.");
			enableVinesTweaksItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Enable VinesTweaks items", true, "Enable custom VinesTweaks items such as G-Chicken Booster. Changing this during a run disables item effects immediately, but fully adding or removing item drops requires a game restart.");
			gChickenBoosterCritChanceBase = ((BaseUnityPlugin)this).Config.Bind<float>("G-Chicken Booster", "Base crit chance percent", 8f, "Critical strike chance granted by the first G-Chicken Booster stack.");
			gChickenBoosterCritChanceStack = ((BaseUnityPlugin)this).Config.Bind<float>("G-Chicken Booster", "Stack crit chance percent", 5f, "Additional critical strike chance granted by each G-Chicken Booster stack after the first.");
			gChickenBoosterCritDamageBase = ((BaseUnityPlugin)this).Config.Bind<float>("G-Chicken Booster", "Base crit damage percent", 6f, "Additional critical strike damage granted by the first G-Chicken Booster stack. This adds to the crit multiplier, so 6 means 200% crits become 206% crits.");
			gChickenBoosterCritDamageStack = ((BaseUnityPlugin)this).Config.Bind<float>("G-Chicken Booster", "Stack crit damage percent", 5f, "Additional critical strike damage granted by each G-Chicken Booster stack after the first.");
			deflectiveYolkCritChanceBase = ((BaseUnityPlugin)this).Config.Bind<float>("Deflective Yolk", "Base crit chance percent", 14f, "Critical strike chance granted by the first Deflective Yolk stack.");
			deflectiveYolkCritChanceStack = ((BaseUnityPlugin)this).Config.Bind<float>("Deflective Yolk", "Stack crit chance percent", 5f, "Additional critical strike chance granted by each Deflective Yolk stack after the first.");
			deflectiveYolkBarrierBase = ((BaseUnityPlugin)this).Config.Bind<float>("Deflective Yolk", "Base barrier percent", 3f, "Temporary barrier gained from a critical hit as a percent of maximum combined health for the first Deflective Yolk stack.");
			deflectiveYolkBarrierStack = ((BaseUnityPlugin)this).Config.Bind<float>("Deflective Yolk", "Stack barrier percent", 3f, "Additional temporary barrier percent gained from each Deflective Yolk stack after the first.");
			deflectiveYolkBarrierCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Deflective Yolk", "Barrier cooldown seconds", 0.25f, "Minimum seconds between Deflective Yolk barrier grants for the same player. Set to 0 to allow every critical hit.");
			debugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Enable debug logging", false, "Log artifact drop rolls, milestone checks, damage tuning, and artifact state changes to the BepInEx console.");
		}

		private static void RegisterRiskOfOptions()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00be: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_0178: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Expected O, but got Unknown
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Expected O, but got Unknown
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Expected O, but got Unknown
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Expected O, but got Unknown
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Expected O, but got Unknown
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Expected O, but got Unknown
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Expected O, but got Unknown
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Expected O, but got Unknown
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Expected O, but got Unknown
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Expected O, but got Unknown
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Expected O, but got Unknown
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Expected O, but got Unknown
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Expected O, but got Unknown
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Expected O, but got Unknown
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Expected O, but got Unknown
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Expected O, but got Unknown
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Expected O, but got Unknown
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Expected O, but got Unknown
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Expected O, but got Unknown
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Expected O, but got Unknown
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Expected O, but got Unknown
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Expected O, but got Unknown
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Expected O, but got Unknown
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Expected O, but got Unknown
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Expected O, but got Unknown
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Expected O, but got Unknown
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Expected O, but got Unknown
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Expected O, but got Unknown
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Expected O, but got Unknown
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Expected O, but got Unknown
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Expected O, but got Unknown
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Expected O, but got Unknown
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Expected O, but got Unknown
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Expected O, but got Unknown
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Expected O, but got Unknown
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Expected O, but got Unknown
			//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Expected O, but got Unknown
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Expected O, but got Unknown
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Expected O, but got Unknown
			//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0701: Expected O, but got Unknown
			//IL_0706: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Expected O, but got Unknown
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Expected O, but got Unknown
			//IL_0738: Unknown result type (might be due to invalid IL or missing references)
			//IL_0742: Expected O, but got Unknown
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Expected O, but got Unknown
			//IL_077e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Expected O, but got Unknown
			//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Expected O, but got Unknown
			//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Expected O, but got Unknown
			//IL_07e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Expected O, but got Unknown
			//IL_080a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0814: Expected O, but got Unknown
			//IL_082d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0837: Expected O, but got Unknown
			//IL_083c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0841: Unknown result type (might be due to invalid IL or missing references)
			//IL_084c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0857: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Expected O, but got Unknown
			//IL_0862: Unknown result type (might be due to invalid IL or missing references)
			//IL_086c: Expected O, but got Unknown
			//IL_0871: Unknown result type (might be due to invalid IL or missing references)
			//IL_087b: Expected O, but got Unknown
			ModSettingsManager.SetModDescription("Adds Risk of Rain 2 artifacts and some other challenging tweaks. Highly configurable.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(monsterDropChance, PercentSlider(0f, 10f, 0.1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(eliteDropChance, PercentSlider(0f, 25f, 0.1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bossExtraDropChance, PercentSlider(0f, 100f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(earlyWhiteLevelCount, new IntSliderConfig
			{
				min = 0,
				max = 25
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(earlyWhiteDropChance, PercentSlider(0f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(redTierLevelThreshold, new IntSliderConfig
			{
				min = 1,
				max = 250
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(redTierDropChance, PercentSlider(0f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(commonTierWeight, WeightSlider()));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(uncommonTierWeight, WeightSlider()));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(legendaryTierWeight, WeightSlider()));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(dropUpVelocity, new StepSliderConfig
			{
				min = 0f,
				max = 60f,
				increment = 1f
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(dropSideVelocity, new StepSliderConfig
			{
				min = 0f,
				max = 30f,
				increment = 1f
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(maxRewardingVinesKillDropsPerSecond, new IntSliderConfig
			{
				min = 0,
				max = 100
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(visualEffectThrottleSeconds, new StepSliderConfig
			{
				min = 0f,
				max = 1f,
				increment = 0.01f
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(commonDirectDamageCap, FractionSlider(0.01f, 1f, 0.01f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(eliteDirectDamageCap, FractionSlider(0.001f, 1f, 0.001f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bossDirectDamageCap, FractionSlider(0.0001f, 1f, 0.0001f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(procDamageMultiplier, FractionSlider(0f, 1f, 0.01f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(procDamageCap, FractionSlider(0f, 1f, 0.001f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(damageBudgetWindow, new StepSliderConfig
			{
				min = 0f,
				max = 1f,
				increment = 0.01f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showRecalibrationEffect));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(commonUndyingSeconds, new StepSliderConfig
			{
				min = 0f,
				max = 30f,
				increment = 0.1f
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(eliteUndyingSeconds, new StepSliderConfig
			{
				min = 0f,
				max = 60f,
				increment = 0.1f
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bossUndyingSeconds, new StepSliderConfig
			{
				min = 0f,
				max = 120f,
				increment = 0.5f
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(undyingPulseInterval, new StepSliderConfig
			{
				min = 0.05f,
				max = 2f,
				increment = 0.05f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showUndyingEffect));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(survivalCommonTriggerPercent, PercentSlider(1f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(survivalEliteTriggerPercent, PercentSlider(1f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(survivalBossTriggerPercent, PercentSlider(1f, 100f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(survivalDamageReductionPercent, PercentSlider(0f, 95f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(survivalDurationSeconds, new StepSliderConfig
			{
				min = 0f,
				max = 10f,
				increment = 0.05f
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(survivalCooldownSeconds, new StepSliderConfig
			{
				min = 0f,
				max = 30f,
				increment = 0.1f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showSurvivalInstinctEffect));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(scrappyProtectedStages, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(scrappyDamageReductionPercent, PercentSlider(0f, 80f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showScrappyEffect));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(escalationStartStage, new IntSliderConfig
			{
				min = 1,
				max = 20
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(escalationDamageReductionPerStagePercent, PercentSlider(0f, 25f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(escalationEliteBonusPercent, PercentSlider(0f, 50f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(escalationBossBonusPercent, PercentSlider(0f, 75f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(escalationMaximumReductionPercent, PercentSlider(0f, 95f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showEscalationEffect));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(sanguineBargainsEnabled));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bloodTitheThresholdPercent, PercentSlider(10f, 500f, 10f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bloodTitheRewardChancePercent, PercentSlider(0f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bloodTitheGreenChancePercent, PercentSlider(0f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bloodTitheRedChancePercent, PercentSlider(0f, 100f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(maxBloodTitheRewardsPerUse, new IntSliderConfig
			{
				min = 0,
				max = 20
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(bloodInsuranceEnabled));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bloodInsuranceHealthThresholdPercent, PercentSlider(1f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(bloodInsuranceBarrierPercent, PercentSlider(0f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showSanguineBargainsEffect));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableVinesTweaksItems));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(gChickenBoosterCritChanceBase, PercentSlider(0f, 25f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(gChickenBoosterCritChanceStack, PercentSlider(0f, 25f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(gChickenBoosterCritDamageBase, PercentSlider(0f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(gChickenBoosterCritDamageStack, PercentSlider(0f, 100f, 1f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(deflectiveYolkCritChanceBase, PercentSlider(0f, 50f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(deflectiveYolkCritChanceStack, PercentSlider(0f, 50f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(deflectiveYolkBarrierBase, PercentSlider(0f, 50f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(deflectiveYolkBarrierStack, PercentSlider(0f, 50f, 0.5f)));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(deflectiveYolkBarrierCooldown, new StepSliderConfig
			{
				min = 0f,
				max = 2f,
				increment = 0.05f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(debugLogging));
		}

		private static StepSliderConfig PercentSlider(float min, float max, float increment)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			return new StepSliderConfig
			{
				min = min,
				max = max,
				increment = increment
			};
		}

		private static StepSliderConfig WeightSlider()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0027: Expected O, but got Unknown
			return new StepSliderConfig
			{
				min = 0f,
				max = 100f,
				increment = 1f
			};
		}

		private static StepSliderConfig FractionSlider(float min, float max, float increment)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			return new StepSliderConfig
			{
				min = min,
				max = max,
				increment = increment
			};
		}

		private static void RegisterArtifacts()
		{
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_REWARDING_VINES_NAME", "Artifact of Rewarding Vines");
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_REWARDING_VINES_DESCRIPTION", "Monsters can drop items. Early player levels can grant white items, and later level milestones can drop red-tier items.");
			LanguageAPI.Add("VINESTWEAKS_REWARDING_VINES_WHITE_REWARD_CHAT", "<color=#7ED957>Rewarding Vines</color> grants an early white item.");
			LanguageAPI.Add("VINESTWEAKS_REWARDING_VINES_RED_REWARD_CHAT", "<color=#7ED957>Rewarding Vines</color> grants a red-tier milestone item.");
			LanguageAPI.Add("VINESTWEAKS_BLOOD_TITHE_REWARD_CHAT", "<color=#7ED957>Sanguine Bargains</color> grants a Blood Tithe item.");
			LanguageAPI.Add("VINESTWEAKS_BLOOD_INSURANCE_CHAT", "<color=#7ED957>Sanguine Bargains</color> grants Blood Insurance barrier.");
			rewardingVinesArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			rewardingVinesArtifact.cachedName = "VINESTWEAKS_REWARDING_VINES";
			rewardingVinesArtifact.nameToken = "ARTIFACT_VINESTWEAKS_REWARDING_VINES_NAME";
			rewardingVinesArtifact.descriptionToken = "ARTIFACT_VINESTWEAKS_REWARDING_VINES_DESCRIPTION";
			rewardingVinesArtifact.smallIconSelectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.RewardingVines, selected: true);
			rewardingVinesArtifact.smallIconDeselectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.RewardingVines, selected: false);
			ContentAddition.AddArtifactDef(rewardingVinesArtifact);
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_RECALIBRATION_NAME", "Artifact of Recalibration");
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_RECALIBRATION_DESCRIPTION", "Massive player hits are recalibrated against enemy threat level. Passive proc-chain damage is dampened so late-game combat stays alive.");
			recalibrationArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			recalibrationArtifact.cachedName = "VINESTWEAKS_RECALIBRATION";
			recalibrationArtifact.nameToken = "ARTIFACT_VINESTWEAKS_RECALIBRATION_NAME";
			recalibrationArtifact.descriptionToken = "ARTIFACT_VINESTWEAKS_RECALIBRATION_DESCRIPTION";
			recalibrationArtifact.smallIconSelectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.Recalibration, selected: true);
			recalibrationArtifact.smallIconDeselectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.Recalibration, selected: false);
			ContentAddition.AddArtifactDef(recalibrationArtifact);
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_UNDYING_NAME", "Artifact of Undying");
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_UNDYING_DESCRIPTION", "Monsters that would die cling to 1 HP, become immune for a short duration based on threat tier, then perish when their last stand ends.");
			LanguageAPI.Add("VINESTWEAKS_UNDYING_BUFF_NAME", "Undying");
			undyingArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			undyingArtifact.cachedName = "VINESTWEAKS_UNDYING";
			undyingArtifact.nameToken = "ARTIFACT_VINESTWEAKS_UNDYING_NAME";
			undyingArtifact.descriptionToken = "ARTIFACT_VINESTWEAKS_UNDYING_DESCRIPTION";
			undyingArtifact.smallIconSelectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.Undying, selected: true);
			undyingArtifact.smallIconDeselectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.Undying, selected: false);
			ContentAddition.AddArtifactDef(undyingArtifact);
			undyingVisibleBuffDef = ScriptableObject.CreateInstance<BuffDef>();
			((Object)undyingVisibleBuffDef).name = "VINESTWEAKS_UNDYING_BUFF";
			undyingVisibleBuffDef.buffColor = new Color(0.49f, 0.85f, 0.34f, 1f);
			undyingVisibleBuffDef.canStack = false;
			undyingVisibleBuffDef.isDebuff = false;
			undyingVisibleBuffDef.iconSprite = undyingArtifact.smallIconSelectedSprite;
			ContentAddition.AddBuffDef(undyingVisibleBuffDef);
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_SURVIVAL_INSTINCT_NAME", "Artifact of Survival Instinct");
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_SURVIVAL_INSTINCT_DESCRIPTION", "Monsters that survive a heavy hit briefly resist follow-up damage, making burst windows feel less absolute.");
			survivalInstinctArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			survivalInstinctArtifact.cachedName = "VINESTWEAKS_SURVIVAL_INSTINCT";
			survivalInstinctArtifact.nameToken = "ARTIFACT_VINESTWEAKS_SURVIVAL_INSTINCT_NAME";
			survivalInstinctArtifact.descriptionToken = "ARTIFACT_VINESTWEAKS_SURVIVAL_INSTINCT_DESCRIPTION";
			survivalInstinctArtifact.smallIconSelectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.SurvivalInstinct, selected: true);
			survivalInstinctArtifact.smallIconDeselectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.SurvivalInstinct, selected: false);
			ContentAddition.AddArtifactDef(survivalInstinctArtifact);
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_SCRAPPY_BEGINNINGS_NAME", "Artifact of Scrappy Beginnings");
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_SCRAPPY_BEGINNINGS_DESCRIPTION", "Players take reduced damage during the opening stages, softening rough starts without changing late-game scaling.");
			scrappyBeginningsArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			scrappyBeginningsArtifact.cachedName = "VINESTWEAKS_SCRAPPY_BEGINNINGS";
			scrappyBeginningsArtifact.nameToken = "ARTIFACT_VINESTWEAKS_SCRAPPY_BEGINNINGS_NAME";
			scrappyBeginningsArtifact.descriptionToken = "ARTIFACT_VINESTWEAKS_SCRAPPY_BEGINNINGS_DESCRIPTION";
			scrappyBeginningsArtifact.smallIconSelectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.ScrappyBeginnings, selected: true);
			scrappyBeginningsArtifact.smallIconDeselectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.ScrappyBeginnings, selected: false);
			ContentAddition.AddArtifactDef(scrappyBeginningsArtifact);
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_ESCALATION_NAME", "Artifact of Escalation");
			LanguageAPI.Add("ARTIFACT_VINESTWEAKS_ESCALATION_DESCRIPTION", "After the early game, monsters gain stage-scaling damage resistance. Elites and bosses resist extra punishment.");
			escalationArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			escalationArtifact.cachedName = "VINESTWEAKS_ESCALATION";
			escalationArtifact.nameToken = "ARTIFACT_VINESTWEAKS_ESCALATION_NAME";
			escalationArtifact.descriptionToken = "ARTIFACT_VINESTWEAKS_ESCALATION_DESCRIPTION";
			escalationArtifact.smallIconSelectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.Escalation, selected: true);
			escalationArtifact.smallIconDeselectedSprite = CreateArtifactGlyphSprite(ArtifactGlyph.Escalation, selected: false);
			ContentAddition.AddArtifactDef(escalationArtifact);
		}

		private static void RegisterItems()
		{
			ConfigEntry<bool>? obj = enableVinesTweaksItems;
			if (obj == null || !obj.Value)
			{
				DebugLog("VinesTweaks item registration skipped because items are disabled.");
				return;
			}
			LanguageAPI.Add("ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_NAME", "G-Chicken Booster");
			LanguageAPI.Add("ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_PICKUP", "Increase critical strike chance and critical strike damage.");
			LanguageAPI.Add("ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_DESCRIPTION", "Gain <style=cIsDamage>8% critical strike chance</style> <style=cStack>(+5% per stack)</style>. Critical strikes deal <style=cIsDamage>6% more damage</style> <style=cStack>(+5% per stack)</style>.");
			LanguageAPI.Add("ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_LORE", "Clinically untested. Emotionally convincing.");
			LanguageAPI.Add("ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_NAME", "Deflective Yolk");
			LanguageAPI.Add("ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_PICKUP", "Critical hits grant temporary barrier.");
			LanguageAPI.Add("ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_DESCRIPTION", "Gain <style=cIsDamage>14% critical strike chance</style> <style=cStack>(+5% per stack)</style>. Critical hits grant <style=cIsHealing>temporary barrier</style> equal to <style=cIsHealing>3% of your maximum health</style> <style=cStack>(+3% per stack)</style>.");
			LanguageAPI.Add("ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_LORE", "Crack under pressure. Shine under worse.");
			gChickenBoosterItem = RegisterCustomItem("VINESTWEAKS_G_CHICKEN_BOOSTER", "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_NAME", "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_DESCRIPTION", "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_LORE", "ITEM_VINESTWEAKS_G_CHICKEN_BOOSTER_PICKUP", CreateGChickenBoosterIconSprite(), (ItemTier)0, (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 });
			deflectiveYolkItem = RegisterCustomItem("VINESTWEAKS_DEFLECTIVE_YOLK", "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_NAME", "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_DESCRIPTION", "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_LORE", "ITEM_VINESTWEAKS_DEFLECTIVE_YOLK_PICKUP", CreateDeflectiveYolkIconSprite(), (ItemTier)1, (ItemTag[])(object)new ItemTag[2]
			{
				(ItemTag)2,
				(ItemTag)3
			});
		}

		private static ItemDef RegisterCustomItem(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, ItemTier tier, ItemTag[] tags)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			CustomItem val = new CustomItem(name, nameToken, descriptionToken, loreToken, pickupToken, pickupIconSprite, (GameObject)null, tier, tags, true, false, (UnlockableDef)null, new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()));
			ItemAPI.Add(val);
			return val.ItemDef;
		}

		private static Sprite CreateGChickenBoosterIconSprite()
		{
			Sprite val = TryLoadIconSprite("g-chicken-booster-icon.png", "VinesTweaksGChickenBoosterIcon");
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			return CreateProceduralGChickenBoosterIconSprite();
		}

		private static Sprite CreateDeflectiveYolkIconSprite()
		{
			Sprite val = TryLoadIconSprite("deflective-yolk-icon.png", "VinesTweaksDeflectiveYolkIcon");
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			return CreateArtifactGlyphSprite(ArtifactGlyph.SurvivalInstinct, selected: true);
		}

		private static Sprite? TryLoadIconSprite(string fileName, string textureName)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			string path = Path.GetDirectoryName(typeof(VinesTweaksPlugin).Assembly.Location) ?? string.Empty;
			string path2 = Path.Combine(path, "assets", fileName);
			if (!File.Exists(path2))
			{
				path2 = Path.Combine(path, fileName);
			}
			if (!File.Exists(path2))
			{
				DebugLog("Icon asset '" + fileName + "' was not found beside the plugin DLL; using generated fallback icon.");
				return null;
			}
			byte[] array = File.ReadAllBytes(path2);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			((Object)val).name = textureName;
			((Texture)val).filterMode = (FilterMode)1;
			if (!ImageConversion.LoadImage(val, array, false))
			{
				Object.Destroy((Object)(object)val);
				VinesTweaksPlugin? vinesTweaksPlugin = instance;
				if (vinesTweaksPlugin != null)
				{
					((BaseUnityPlugin)vinesTweaksPlugin).Logger.LogWarning((object)("Icon asset '" + fileName + "' could not be loaded; using generated fallback icon."));
				}
				return null;
			}
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), (float)((Texture)val).width);
		}

		private static Sprite CreateProceduralGChickenBoosterIconSprite()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			((Object)val).name = "VinesTweaksGChickenBoosterIcon";
			((Texture)val).filterMode = (FilterMode)1;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.98f, 0.99f, 0.94f, 1f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.78f, 0.84f, 0.77f, 1f);
			Color val4 = default(Color);
			((Color)(ref val4))..ctor(1f, 1f, 0.93f, 1f);
			Color val5 = default(Color);
			((Color)(ref val5))..ctor(0.36f, 0.76f, 0.27f, 1f);
			Color val6 = default(Color);
			((Color)(ref val6))..ctor(0.76f, 1f, 0.29f, 1f);
			Color val7 = default(Color);
			((Color)(ref val7))..ctor(0.02f, 0.08f, 0.025f, 1f);
			Color fill = default(Color);
			((Color)(ref fill))..ctor(0.07f, 0.26f, 0.08f, 1f);
			Color val8 = default(Color);
			((Color)(ref val8))..ctor(0f, 0f, 0f, 0.36f);
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					Vector2 val9 = RotateIntoBoosterSpace(new Vector2((float)j - 64f, (float)i - 64f), -28f);
					float x = val9.x;
					float y = val9.y;
					BoosterSilhouette(x, y, 0f);
					bool num = BoosterSilhouette(x, y, 3f);
					bool num2 = BoosterSilhouette(x, y, 7f);
					bool num3 = BoosterSilhouette(x - 5f, y + 6f, 8f);
					bool flag = IsCapsule(x, y, -38f, 24f, 14f);
					bool flag2 = x > 21f && x < 40f && Mathf.Abs(y) < 8f;
					bool flag3 = Distance(x, y, 34f, 12f) < 5f || Distance(x, y, 42f, 9f) < 4.5f;
					bool flag4 = x > -27f && x < 0f && Mathf.Abs(y) < 6f;
					bool flag5 = Distance(x, y, 11f, 0f) < 8.5f;
					bool flag6 = x > -28f && x < 1f && Mathf.Abs(y + 7f) < 1.4f;
					Color val10 = Color.clear;
					if (num3)
					{
						val10 = val8;
					}
					if (num2)
					{
						val10 = val2;
					}
					if (num)
					{
						val10 = val7;
					}
					if (flag || flag2 || flag3)
					{
						val10 = val3;
					}
					if (flag4)
					{
						val10 = Color.Lerp(val5, val6, Mathf.Clamp01((y + 6f) / 12f));
					}
					if (flag6)
					{
						val10 = val4;
					}
					if (flag5)
					{
						val10 = val5;
					}
					if ((flag || flag2) && y > 4f && x < 16f)
					{
						val10 = Color.Lerp(val10, val4, 0.42f);
					}
					val.SetPixel(j, i, val10);
				}
			}
			DrawSimpleG(val, 75, 63, val7);
			DrawFeather(val, 45, 76, val7, fill);
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 128f);
		}

		private static Vector2 RotateIntoBoosterSpace(Vector2 point, float degrees)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			float num = degrees * (MathF.PI / 180f);
			float num2 = Mathf.Cos(num);
			float num3 = Mathf.Sin(num);
			return new Vector2(point.x * num2 - point.y * num3, point.x * num3 + point.y * num2);
		}

		private static bool BoosterSilhouette(float x, float y, float inflate)
		{
			if (!IsCapsule(x, y, -38f - inflate, 24f + inflate, 14f + inflate) && (!(x > 21f - inflate) || !(x < 40f + inflate) || !(Mathf.Abs(y) < 8f + inflate)) && !(Distance(x, y, 34f, 12f) < 5f + inflate))
			{
				return Distance(x, y, 42f, 9f) < 4.5f + inflate;
			}
			return true;
		}

		private static bool IsCapsule(float x, float y, float left, float right, float radius)
		{
			if (x >= left && x <= right && Mathf.Abs(y) <= radius)
			{
				return true;
			}
			if (!(Distance(x, y, left, 0f) <= radius))
			{
				return Distance(x, y, right, 0f) <= radius;
			}
			return true;
		}

		private static float Distance(float x, float y, float centerX, float centerY)
		{
			float num = x - centerX;
			float num2 = y - centerY;
			return Mathf.Sqrt(num * num + num2 * num2);
		}

		private static void DrawSimpleG(Texture2D texture, int centerX, int centerY, Color color)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			DrawRect(texture, centerX - 5, centerY - 6, 11, 2, color);
			DrawRect(texture, centerX - 6, centerY - 5, 2, 11, color);
			DrawRect(texture, centerX - 5, centerY + 5, 11, 2, color);
			DrawRect(texture, centerX + 4, centerY + 1, 2, 5, color);
			DrawRect(texture, centerX + 1, centerY + 1, 5, 2, color);
		}

		private static void DrawFeather(Texture2D texture, int centerX, int centerY, Color outline, Color fill)
		{
			//IL_0068: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			for (int i = -7; i <= 7; i++)
			{
				for (int j = -10; j <= 10; j++)
				{
					float num = (float)(j * j) / 100f + (float)(i * i) / 36f;
					if (num <= 1f)
					{
						texture.SetPixel(centerX + j, centerY + i, fill);
					}
					else if (num <= 1.18f)
					{
						texture.SetPixel(centerX + j, centerY + i, outline);
					}
				}
			}
			DrawRect(texture, centerX - 1, centerY - 8, 2, 17, outline);
		}

		private static void DrawRect(Texture2D texture, int x, int y, int width, int height, Color color)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			for (int i = y; i < y + height; i++)
			{
				for (int j = x; j < x + width; j++)
				{
					if (j >= 0 && i >= 0 && j < ((Texture)texture).width && i < ((Texture)texture).height)
					{
						texture.SetPixel(j, i, color);
					}
				}
			}
		}

		private static Sprite CreateArtifactGlyphSprite(ArtifactGlyph glyph, bool selected)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
			((Object)val).name = "VinesTweaks" + glyph.ToString() + "ArtifactIcon";
			((Texture)val).filterMode = (FilterMode)0;
			Vector2 center = default(Vector2);
			((Vector2)(ref center))..ctor(63.5f, 63.5f);
			Color val2 = (selected ? new Color(0.49f, 0.85f, 0.34f, 0.92f) : new Color(0.1f, 0.26f, 0.12f, 0.82f));
			Color val3 = (selected ? new Color(0.02f, 0.12f, 0.04f, 0.82f) : new Color(0.01f, 0.04f, 0.015f, 0.78f));
			bool[,] array = new bool[64, 64];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					int x = j * 2 + 1;
					int y = i * 2 + 1;
					array[j, i] = glyph switch
					{
						ArtifactGlyph.ScrappyBeginnings => IsScrappyBeginningsGlyph(x, y, center), 
						ArtifactGlyph.SurvivalInstinct => IsSurvivalInstinctGlyph(x, y, center), 
						ArtifactGlyph.Undying => IsUndyingGlyph(x, y, center), 
						ArtifactGlyph.Recalibration => IsRecalibrationGlyph(x, y, center), 
						ArtifactGlyph.RewardingVines => IsRewardingVinesGlyph(x, y, center), 
						_ => IsEscalationGlyph(x, y, center), 
					};
				}
			}
			for (int k = 0; k < 64; k++)
			{
				for (int l = 0; l < 64; l++)
				{
					Color val4 = Color.clear;
					if (array[l, k])
					{
						val4 = val2;
					}
					else if (HasNeighborPixel(array, l, k, 64))
					{
						val4 = val3;
					}
					val.SetPixel(l, k, val4);
				}
			}
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 64f);
		}

		private static bool HasNeighborPixel(bool[,] mask, int x, int y, int size)
		{
			for (int i = -1; i <= 1; i++)
			{
				for (int j = -1; j <= 1; j++)
				{
					if (j != 0 || i != 0)
					{
						int num = x + j;
						int num2 = y + i;
						if (num >= 0 && num < size && num2 >= 0 && num2 < size && mask[num, num2])
						{
							return true;
						}
					}
				}
			}
			return false;
		}

		private static bool IsRewardingVinesGlyph(int x, int y, Vector2 center)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)x - center.x;
			float num2 = (float)y - center.y;
			float num3 = Mathf.Sqrt(num * num + num2 * num2);
			bool flag = Mathf.Abs(num3 - 38f) < 5f && num < 0f && num2 > -30f && num2 < 35f;
			bool flag2 = Mathf.Abs(num3 - 38f) < 5f && num > 0f && num2 > -35f && num2 < 30f;
			bool flag3 = Mathf.Abs(num + Mathf.Sin((float)y * 0.11f) * 10f) < 4f && num2 > -40f && num2 < 38f;
			bool flag4 = Ellipse(num + 25f, num2 + 16f, 13f, 7f, -0.55f);
			bool flag5 = Ellipse(num - 24f, num2 - 8f, 12f, 7f, 0.65f);
			bool flag6 = num3 < 7f;
			return flag || flag2 || flag3 || flag4 || flag5 || flag6;
		}

		private static bool IsRecalibrationGlyph(int x, int y, Vector2 center)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)x - center.x;
			float num2 = (float)y - center.y;
			bool num3 = Mathf.Abs(Mathf.Max(Mathf.Abs(num), Mathf.Abs(num2)) - 36f) < 5f;
			bool flag = Mathf.Abs(Mathf.Max(Mathf.Abs(num), Mathf.Abs(num2)) - 15f) < 4f;
			bool flag2 = Mathf.Abs(num2) < 4f && Mathf.Abs(num) < 48f;
			bool flag3 = Mathf.Abs(num) < 4f && Mathf.Abs(num2) < 48f;
			bool flag4 = Mathf.Abs(num) > 24f && Mathf.Abs(num2) > 24f;
			return (num3 && !flag4) || flag || flag2 || flag3;
		}

		private static bool IsUndyingGlyph(int x, int y, Vector2 center)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)x - center.x;
			float num2 = (float)y - center.y;
			float num3 = Mathf.Sqrt(num * num + num2 * num2);
			bool num4 = Mathf.Abs(num3 - 34f) < 5f && num2 < 16f;
			bool flag = Mathf.Abs(num2 - 34f) < 5f && Mathf.Abs(num) < 38f;
			bool flag2 = Mathf.Abs(num) < 5f && num2 > -30f && num2 < 34f;
			bool flag3 = Ellipse(num + 18f, num2 - 2f, 8f, 23f, -0.25f);
			bool flag4 = Ellipse(num - 18f, num2 - 2f, 8f, 23f, 0.25f);
			bool flag5 = num3 < 8f;
			return num4 || flag || flag2 || flag3 || flag4 || flag5;
		}

		private static bool IsSurvivalInstinctGlyph(int x, int y, Vector2 center)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)x - center.x;
			float num2 = (float)y - center.y;
			float num3 = Mathf.Sqrt(num * num + num2 * num2);
			bool flag = Mathf.Abs(num2 + 17f) < 5f && Mathf.Abs(num) < 28f;
			bool flag2 = Mathf.Abs(Mathf.Abs(num) - (28f - Mathf.Max(0f, num2 + 17f) * 0.35f)) < 5f && num2 > -17f && num2 < 38f;
			bool flag3 = Mathf.Abs(num) < 7f && num2 > 24f && num2 < 44f;
			bool flag4 = Ellipse(num, num2 + 3f, 20f, 9f, 0f) && !Ellipse(num, num2 + 3f, 10f, 4f, 0f);
			bool flag5 = Mathf.Abs(num3 - 41f) < 4f && Mathf.Abs(num + num2) < 8f && num2 < -22f;
			return flag || flag2 || flag3 || flag4 || flag5;
		}

		private static bool IsScrappyBeginningsGlyph(int x, int y, Vector2 center)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)x - center.x;
			float num2 = (float)y - center.y;
			bool num3 = Mathf.Abs(num2 - 32f) < 5f && Mathf.Abs(num) < 42f;
			bool flag = Mathf.Abs(num2 - 14f) < 5f && num > -34f && num < 4f;
			bool flag2 = Mathf.Abs(num2 + 4f) < 5f && num > -5f && num < 34f;
			bool flag3 = Mathf.Abs(num + 34f) < 5f && num2 > 14f && num2 < 32f;
			bool flag4 = Mathf.Abs(num + 4f) < 5f && num2 > -4f && num2 < 14f;
			bool flag5 = Mathf.Abs(num - 26f) + Mathf.Abs(num2 + 29f) < 18f;
			bool flag6 = Mathf.Abs(num - 26f) < 7f && Mathf.Abs(num2 + 29f) < 7f;
			if (!(num3 || flag || flag2 || flag3 || flag4))
			{
				if (flag5)
				{
					return !flag6;
				}
				return false;
			}
			return true;
		}

		private static bool IsEscalationGlyph(int x, int y, Vector2 center)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)x - center.x;
			float num2 = (float)y - center.y;
			bool num3 = Mathf.Abs(Mathf.Abs(num) - (32f - (num2 + 28f) * 0.8f)) < 5f && num2 > -28f && num2 < 7f;
			bool flag = Mathf.Abs(Mathf.Abs(num) - (24f - (num2 + 4f) * 0.8f)) < 5f && num2 > -4f && num2 < 24f;
			bool flag2 = Mathf.Abs(num) < 5f && num2 > -31f && num2 < 38f;
			bool flag3 = Mathf.Abs(num2 - 38f) < 5f && Mathf.Abs(num) < 25f;
			bool flag4 = Mathf.Abs(num2 + 39f) < 5f && (Mathf.Abs(num - 23f) < 7f || Mathf.Abs(num + 23f) < 7f);
			return num3 || flag || flag2 || flag3 || flag4;
		}

		private static bool Ellipse(float x, float y, float rx, float ry, float rotation)
		{
			float num = Mathf.Cos(rotation);
			float num2 = Mathf.Sin(rotation);
			float num3 = x * num - y * num2;
			float num4 = x * num2 + y * num;
			return num3 * num3 / (rx * rx) + num4 * num4 / (ry * ry) <= 1f;
		}

		private static void OnCharacterDeathGlobal(DamageReport damageReport)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)damageReport.victimBody.healthComponent))
			{
				RemoveUndyingBuff(damageReport.victimBody);
				recalibrationBudgets.Remove(damageReport.victimBody.healthComponent);
				survivalInstinctMonsters.Remove(damageReport.victimBody.healthComponent);
				undyingMonsters.Remove(damageReport.victimBody.healthComponent);
			}
			if (!NetworkServer.active || (Object)(object)rewardingVinesArtifact == (Object)null || (Object)(object)Run.instance == (Object)null || !Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(rewardingVinesArtifact))
			{
				return;
			}
			CharacterBody victimBody = damageReport.victimBody;
			if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimBody.teamComponent) || (int)victimBody.teamComponent.teamIndex != 2 || (Object.op_Implicit((Object)(object)victimBody.master) && Object.op_Implicit((Object)(object)victimBody.master.playerCharacterMasterController)))
			{
				return;
			}
			if (!IsPlayerAttacker(damageReport.attackerBody))
			{
				DebugLog("Rewarding Vines ignored a non-player monster death.");
				return;
			}
			bool isChampion = victimBody.isChampion;
			bool isElite = victimBody.isElite;
			if (isChampion)
			{
				TryDropWeightedItem(victimBody, bossExtraDropChance.Value);
			}
			else if (isElite)
			{
				TryDropWeightedItem(victimBody, eliteDropChance.Value);
			}
			else
			{
				TryDropWeightedItem(victimBody, monsterDropChance.Value);
			}
		}

		private static void OnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			if (TryBlockUndyingDamage(self, damageInfo))
			{
				orig.Invoke(self, damageInfo);
				return;
			}
			TryApplyScrappyBeginningsProtection(self, damageInfo);
			TryRecalibrateDamage(self, damageInfo);
			TryApplySurvivalInstinctResistance(self, damageInfo);
			TryApplyEscalationResistance(self, damageInfo);
			TryTriggerSurvivalInstinct(self, damageInfo);
			TryTriggerUndying(self, damageInfo);
			orig.Invoke(self, damageInfo);
		}

		private static void OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			orig.Invoke(self, damageInfo, victim);
			TryGrantDeflectiveYolkBarrier(damageInfo);
		}

		private static void OnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			ConfigEntry<bool>? obj = enableVinesTweaksItems;
			if (obj == null || !obj.Value || (Object)(object)sender == (Object)null || (Object)(object)sender.inventory == (Object)null)
			{
				return;
			}
			if ((Object)(object)gChickenBoosterItem != (Object)null)
			{
				int itemCount = sender.inventory.GetItemCount(gChickenBoosterItem);
				if (itemCount > 0)
				{
					float num = StackValue(Mathf.Clamp(gChickenBoosterCritChanceBase?.Value ?? 0f, 0f, 100f), Mathf.Clamp(gChickenBoosterCritChanceStack?.Value ?? 0f, 0f, 100f), itemCount);
					float num2 = StackValue(Mathf.Clamp(gChickenBoosterCritDamageBase?.Value ?? 0f, 0f, 500f), Mathf.Clamp(gChickenBoosterCritDamageStack?.Value ?? 0f, 0f, 500f), itemCount);
					args.critAdd += num;
					args.critDamageMultAdd += num2 / 100f;
				}
			}
			if ((Object)(object)deflectiveYolkItem != (Object)null)
			{
				int itemCount2 = sender.inventory.GetItemCount(deflectiveYolkItem);
				if (itemCount2 > 0)
				{
					args.critAdd += StackValue(Mathf.Clamp(deflectiveYolkCritChanceBase?.Value ?? 0f, 0f, 100f), Mathf.Clamp(deflectiveYolkCritChanceStack?.Value ?? 0f, 0f, 100f), itemCount2);
				}
			}
		}

		private static void TryGrantDeflectiveYolkBarrier(DamageInfo damageInfo)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			if (!NetworkServer.active)
			{
				return;
			}
			ConfigEntry<bool>? obj = enableVinesTweaksItems;
			if (obj == null || !obj.Value || (Object)(object)deflectiveYolkItem == (Object)null || (Object)(object)damageInfo.attacker == (Object)null || !damageInfo.crit)
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if ((Object)(object)component == (Object)null || (Object)(object)component.inventory == (Object)null || (Object)(object)component.healthComponent == (Object)null)
			{
				return;
			}
			TeamComponent teamComponent = component.teamComponent;
			if ((Object)(object)teamComponent == (Object)null || (int)teamComponent.teamIndex != 1)
			{
				return;
			}
			int itemCount = component.inventory.GetItemCount(deflectiveYolkItem);
			if (itemCount <= 0)
			{
				return;
			}
			float num = Mathf.Max(0f, deflectiveYolkBarrierCooldown?.Value ?? 0f);
			if (num > 0f && deflectiveYolkCooldowns.TryGetValue(component, out var value) && Time.time < value)
			{
				return;
			}
			float num2 = StackValue(Mathf.Clamp(deflectiveYolkBarrierBase?.Value ?? 0f, 0f, 100f), Mathf.Clamp(deflectiveYolkBarrierStack?.Value ?? 0f, 0f, 100f), itemCount);
			if (num2 <= 0f)
			{
				return;
			}
			float num3 = GetVictimMaxHealth(component.healthComponent, component) * num2 / 100f;
			if (!(num3 <= 0f))
			{
				component.healthComponent.AddBarrier(num3);
				if (num > 0f)
				{
					deflectiveYolkCooldowns[component] = Time.time + num;
				}
				DebugLog($"Deflective Yolk granted {num3:0.##} barrier to {component.GetDisplayName()}.");
			}
		}

		private static float StackValue(float firstStack, float additionalStack, int itemCount)
		{
			if (itemCount > 0)
			{
				return firstStack + additionalStack * (float)(itemCount - 1);
			}
			return 0f;
		}

		private static void OnPurchaseInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Invalid comparison between Unknown and I4
			if ((Object)(object)FindBloodShrineBehavior(self) == (Object)null)
			{
				orig.Invoke(self, activator);
				return;
			}
			CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent<CharacterBody>() : null);
			HealthComponent val2 = (((Object)(object)val != (Object)null) ? val.healthComponent : null);
			float num = (((Object)(object)val2 != (Object)null) ? val2.combinedHealth : 0f);
			orig.Invoke(self, activator);
			if (!NetworkServer.active)
			{
				return;
			}
			ConfigEntry<bool>? obj = sanguineBargainsEnabled;
			if (obj == null || !obj.Value || (Object)(object)Run.instance == (Object)null || (Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val.master == (Object)null)
			{
				return;
			}
			TeamComponent teamComponent = val.teamComponent;
			if (!((Object)(object)teamComponent == (Object)null) && (int)teamComponent.teamIndex == 1)
			{
				float num2 = Mathf.Max(0f, num - val2.combinedHealth);
				if (!(num2 <= 0f))
				{
					TryGrantBloodInsurance(val, val2);
					TryGrantBloodTitheReward(val, val2, num2);
				}
			}
		}

		private static ShrineBloodBehavior? FindBloodShrineBehavior(PurchaseInteraction purchaseInteraction)
		{
			if (!Object.op_Implicit((Object)(object)purchaseInteraction))
			{
				return null;
			}
			ShrineBloodBehavior component = ((Component)purchaseInteraction).GetComponent<ShrineBloodBehavior>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			component = ((Component)purchaseInteraction).GetComponentInParent<ShrineBloodBehavior>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			return ((Component)purchaseInteraction).GetComponentInChildren<ShrineBloodBehavior>();
		}

		private static void TryGrantBloodInsurance(CharacterBody body, HealthComponent healthComponent)
		{
			ConfigEntry<bool>? obj = bloodInsuranceEnabled;
			if (obj == null || !obj.Value)
			{
				return;
			}
			float victimMaxHealth = GetVictimMaxHealth(healthComponent, body);
			float num = healthComponent.combinedHealth / victimMaxHealth * 100f;
			if (num > Mathf.Clamp(bloodInsuranceHealthThresholdPercent.Value, 1f, 100f))
			{
				return;
			}
			float num2 = victimMaxHealth * Mathf.Clamp(bloodInsuranceBarrierPercent.Value, 0f, 100f) / 100f;
			if (!(num2 <= 0f))
			{
				healthComponent.AddBarrier(num2);
				ConfigEntry<bool>? obj2 = showSanguineBargainsEffect;
				if (obj2 != null && obj2.Value)
				{
					SpawnBodyEffect(sanguineBargainsEffectPrefab, body, "sanguine bargains");
				}
				SendSimpleChat("VINESTWEAKS_BLOOD_INSURANCE_CHAT");
				DebugLog($"Blood Insurance granted {num2:0.##} barrier to {body.GetDisplayName()} at {num:0.##}% health.");
			}
		}

		private static void TryGrantBloodTitheReward(CharacterBody body, HealthComponent healthComponent, float healthSpent)
		{
			CharacterMaster master = body.master;
			float victimMaxHealth = GetVictimMaxHealth(healthComponent, body);
			float num = healthSpent / victimMaxHealth * 100f;
			float num2 = Mathf.Max(1f, bloodTitheThresholdPercent.Value);
			bloodTitheProgress.TryGetValue(master, out var value);
			value += num;
			int num3 = 0;
			int num4 = Mathf.Max(0, maxBloodTitheRewardsPerUse.Value);
			while (value >= num2 && num3 < num4)
			{
				value -= num2;
				num3++;
			}
			if (value >= num2)
			{
				DebugLog($"Blood Tithe discarded excess progress above {num4} rewards for this shrine use.");
				value = Mathf.Max(0f, num2 - 0.001f);
			}
			bloodTitheProgress[master] = value;
			DebugLog($"Blood Tithe progress for {body.GetDisplayName()}: +{num:0.##}%, stored {value:0.##}%, rewards {num3}.");
			for (int i = 0; i < num3; i++)
			{
				if (!Roll(bloodTitheRewardChancePercent.Value))
				{
					DebugLog($"Blood Tithe reward roll failed at {bloodTitheRewardChancePercent.Value:0.##}%.");
				}
				else if (TryDropTierItem(body, SelectBloodTitheDropList(), 100f))
				{
					SendSimpleChat("VINESTWEAKS_BLOOD_TITHE_REWARD_CHAT");
					ConfigEntry<bool>? obj = showSanguineBargainsEffect;
					if (obj != null && obj.Value)
					{
						SpawnBodyEffect(sanguineBargainsEffectPrefab, body, "sanguine bargains");
					}
				}
			}
		}

		private static List<PickupIndex> SelectBloodTitheDropList()
		{
			Run val = Run.instance;
			if (Roll(bloodTitheRedChancePercent.Value))
			{
				return val.availableTier3DropList;
			}
			if (Roll(bloodTitheGreenChancePercent.Value))
			{
				return val.availableTier2DropList;
			}
			return val.availableTier1DropList;
		}

		private static void TryApplyScrappyBeginningsProtection(HealthComponent self, DamageInfo damageInfo)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Invalid comparison between Unknown and I4
			if (!NetworkServer.active || !IsArtifactEnabled(scrappyBeginningsArtifact) || (Object)(object)Run.instance == (Object)null || (Object)(object)self == (Object)null || damageInfo == null || damageInfo.damage <= 0f)
			{
				return;
			}
			CharacterBody body = self.body;
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.teamComponent) || (int)body.teamComponent.teamIndex != 1)
			{
				return;
			}
			int num = Mathf.Max(0, scrappyProtectedStages.Value);
			int currentStageNumber = GetCurrentStageNumber();
			if (num <= 0 || currentStageNumber > num)
			{
				return;
			}
			float num2 = Mathf.Clamp(scrappyDamageReductionPercent.Value, 0f, 95f) / 100f;
			if (!(num2 <= 0f))
			{
				float damage = damageInfo.damage;
				damageInfo.damage *= 1f - num2;
				ConfigEntry<bool>? obj = showScrappyEffect;
				if (obj != null && obj.Value)
				{
					SpawnBodyEffect(scrappyBeginningsEffectPrefab, body, "scrappy beginnings");
				}
				DebugLog($"Scrappy Beginnings reduced player damage on stage {currentStageNumber}: {damage:0.##} -> {damageInfo.damage:0.##}.");
			}
		}

		private static void TryRecalibrateDamage(HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || (Object)(object)recalibrationArtifact == (Object)null || (Object)(object)Run.instance == (Object)null || (Object)(object)self == (Object)null || damageInfo == null || !Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(recalibrationArtifact) || damageInfo.damage <= 0f)
			{
				return;
			}
			CharacterBody body = self.body;
			if (!IsValidMonsterVictim(body) || !IsPlayerAttacker(Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent<CharacterBody>() : null))
			{
				return;
			}
			float damage = damageInfo.damage;
			if (damageInfo.procCoefficient >= 1f)
			{
				float num = GetDirectDamageCap(body);
				float num2 = Mathf.Max(0f, damageBudgetWindow.Value);
				if (num2 > 0f)
				{
					num = GetRemainingWindowBudget(self, num, num2);
				}
				damageInfo.damage = Mathf.Min(damageInfo.damage, num);
				RememberWindowDamage(self, damageInfo.damage, num2);
			}
			else
			{
				float victimMaxHealth = GetVictimMaxHealth(self, body);
				float num3 = Mathf.Clamp(procDamageMultiplier.Value, 0f, 1f);
				float num4 = victimMaxHealth * Mathf.Clamp(procDamageCap.Value, 0f, 1f);
				damageInfo.damage = Mathf.Min(damage * num3, num4);
			}
			if (damageInfo.damage < damage)
			{
				if (damageInfo.damage <= 0f)
				{
					damageInfo.rejected = true;
				}
				SpawnRecalibrationEffect(damageInfo.position, body);
				DebugLog($"Recalibrated {body.GetDisplayName()}: {damage:0.##} -> {damageInfo.damage:0.##}, proc={damageInfo.procCoefficient:0.##}.");
			}
		}

		private static bool IsValidMonsterVictim(CharacterBody victimBody)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimBody.teamComponent) || (int)victimBody.teamComponent.teamIndex != 2)
			{
				return false;
			}
			if (Object.op_Implicit((Object)(object)victimBody.master))
			{
				return !Object.op_Implicit((Object)(object)victimBody.master.playerCharacterMasterController);
			}
			return true;
		}

		private static bool IsPlayerAttacker(CharacterBody? attackerBody)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			if ((Object)(object)attackerBody != (Object)null && (Object)(object)attackerBody.teamComponent != (Object)null)
			{
				return (int)attackerBody.teamComponent.teamIndex == 1;
			}
			return false;
		}

		private static void TryApplySurvivalInstinctResistance(HealthComponent self, DamageInfo damageInfo)
		{
			if (!NetworkServer.active || !IsArtifactEnabled(surviva