Decompiled source of EdsArtifacts v1.14.56

EdsArtifacts.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Toolbot;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.CharacterAI;
using On.RoR2.Networking;
using On.RoR2.Orbs;
using On.RoR2.Projectile;
using On.RoR2.Scripts.GameBehaviors;
using On.RoR2.UI;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Artifacts;
using RoR2.Audio;
using RoR2.CameraModes;
using RoR2.CharacterAI;
using RoR2.Networking;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Scripts.GameBehaviors;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EdsArtifacts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EdsArtifacts")]
[assembly: AssemblyTitle("EdsArtifacts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 EdsArtifacts
{
	internal static class AfflictionArtifact
	{
		private struct Status
		{
			public BuffDef Def;

			public int Count;

			public float Duration;

			public bool Timed;

			public bool Dot;

			public DotIndex DotIndex;
		}

		private const float PulseInterval = 0.25f;

		private const int MaxStacksPerPulse = 40;

		private static ConfigEntry<float> _radius;

		private static ConfigEntry<bool> _reapply;

		private static ConfigEntry<bool> _enemies;

		private static readonly List<Status> Statuses = new List<Status>();

		private static readonly List<CharacterBody> Players = new List<CharacterBody>();

		private static float _nextPulse;

		public static void Bind(ConfigFile config)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			_radius = config.Bind<float>("Affliction", "Radius", 5f, new ConfigDescription("Meters in which statuses spread. Doubled artifacts double this.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>()));
			_reapply = config.Bind<bool>("Affliction", "Reapply", true, "When on, a status is refreshed on someone who already has it. When off, it only spreads to someone who does not have it yet.");
			_enemies = config.Bind<bool>("Affliction", "EnemiesSpread", false, "When on, enemies also pass statuses to whoever is nearby. Off by default.");
		}

		public static void RegisterSettings()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0094: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_radius, new StepSliderConfig
			{
				min = 1f,
				max = 50f,
				increment = 0.5f,
				FormatString = "{0:0.0}m",
				name = "Spread radius",
				description = "Meters in which statuses spread. Doubled artifacts double this.",
				category = "Affliction"
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_reapply, new CheckBoxConfig
			{
				name = "Reapply to affected targets",
				description = "When on, a status is refreshed on someone who already has it.",
				category = "Affliction"
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_enemies, new CheckBoxConfig
			{
				name = "Enemies spread statuses",
				description = "When on, enemies also pass statuses to whoever is nearby.",
				category = "Affliction"
			}));
		}

		public static void FixedUpdateTick()
		{
			int effectLevel = ArtifactRegistry.GetEffectLevel(ArtifactRegistry.Affliction);
			if (effectLevel > 0 && NetworkServer.active && !(Time.time < _nextPulse))
			{
				_nextPulse = Time.time + 0.25f;
				float radius = ((_radius != null) ? _radius.Value : 5f) * (float)effectLevel;
				Share(radius);
			}
		}

		private static void Share(float radius)
		{
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Invalid comparison between Unknown and I4
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			Players.Clear();
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				CharacterBody val = (Object.op_Implicit((Object)(object)((instance != null) ? instance.master : null)) ? instance.master.GetBody() : null);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive)
				{
					Players.Add(val);
				}
			}
			if (Players.Count < 2 && (_enemies == null || !_enemies.Value))
			{
				return;
			}
			if (_enemies != null && _enemies.Value)
			{
				ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList;
				for (int i = 0; i < readOnlyInstancesList.Count; i++)
				{
					CharacterBody val2 = readOnlyInstancesList[i];
					if (Object.op_Implicit((Object)(object)val2) && !val2.isPlayerControlled && Object.op_Implicit((Object)(object)val2.healthComponent) && val2.healthComponent.alive && (!Object.op_Implicit((Object)(object)val2.teamComponent) || (int)val2.teamComponent.teamIndex != 1))
					{
						Players.Add(val2);
					}
				}
			}
			if (Players.Count < 2)
			{
				return;
			}
			float num = radius * radius;
			for (int j = 0; j < Players.Count; j++)
			{
				Collect(Players[j]);
				if (Statuses.Count == 0)
				{
					continue;
				}
				Vector3 corePosition = Players[j].corePosition;
				for (int k = 0; k < Players.Count; k++)
				{
					if (j != k)
					{
						Vector3 val3 = corePosition - Players[k].corePosition;
						if (((Vector3)(ref val3)).sqrMagnitude <= num)
						{
							Apply(Players[j], Players[k]);
						}
					}
				}
			}
		}

		private static void Collect(CharacterBody body)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			Statuses.Clear();
			int buffCount = BuffCatalog.buffCount;
			float num = default(float);
			for (int i = 0; i < buffCount; i++)
			{
				BuffDef buffDef = BuffCatalog.GetBuffDef((BuffIndex)i);
				if (!Object.op_Implicit((Object)(object)buffDef) || buffDef.isHidden || buffDef.isCooldown)
				{
					continue;
				}
				int buffCount2 = body.GetBuffCount(buffDef);
				if (buffCount2 > 0)
				{
					bool timed = body.GetTimedBuffTotalDurationForIndex(buffDef.buffIndex, ref num) && num > 0f;
					bool flag = buffDef.isDOT;
					DotIndex val = (DotIndex)(flag ? ((int)DotController.GetDotDefIndex(buffDef)) : 0);
					if (flag && DotController.GetDotDef(val) == null)
					{
						flag = false;
					}
					Statuses.Add(new Status
					{
						Def = buffDef,
						Count = buffCount2,
						Duration = num,
						Timed = timed,
						Dot = flag,
						DotIndex = val
					});
				}
			}
		}

		private static void Apply(CharacterBody source, CharacterBody target)
		{
			for (int i = 0; i < Statuses.Count; i++)
			{
				Status status = Statuses[i];
				if (_reapply != null && !_reapply.Value && target.GetBuffCount(status.Def) > 0)
				{
					continue;
				}
				if (status.Dot)
				{
					SpreadDot(source, target, status);
					continue;
				}
				if (status.Timed && !status.Def.canStack)
				{
					target.AddTimedBuff(status.Def, status.Duration);
					continue;
				}
				int num = status.Count - target.GetBuffCount(status.Def);
				if (num <= 0)
				{
					continue;
				}
				if (num > 40)
				{
					num = 40;
				}
				if (status.Timed)
				{
					for (int j = 0; j < num; j++)
					{
						target.AddTimedBuff(status.Def, status.Duration);
					}
				}
				else
				{
					for (int k = 0; k < num; k++)
					{
						target.AddBuff(status.Def);
					}
				}
			}
		}

		private static void SpreadDot(CharacterBody source, CharacterBody target, Status status)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			int num = status.Count - target.GetBuffCount(status.Def);
			if (num <= 0)
			{
				return;
			}
			if (num > 40)
			{
				num = 40;
			}
			float duration = status.Duration;
			if (duration <= 0f)
			{
				DotController val = DotController.FindDotController(((Component)source).gameObject);
				if (!Object.op_Implicit((Object)(object)val) || !val.GetDotStackTotalDurationForIndex(status.DotIndex, ref duration) || duration <= 0f)
				{
					return;
				}
			}
			if (!Object.op_Implicit((Object)(object)target.mainHurtBox))
			{
				target.AddTimedBuff(status.Def, duration);
				return;
			}
			for (int i = 0; i < num; i++)
			{
				DotController.InflictDot(((Component)target).gameObject, ((Component)source).gameObject, target.mainHurtBox, default(ProcChainMask), status.DotIndex, duration, 1f, (uint?)null);
			}
		}
	}
	internal static class AmalgamationArtifact
	{
		private enum StatKind
		{
			Health,
			Shield,
			Damage,
			MoveSpeed,
			AttackSpeed,
			CritChance,
			CritDamage,
			Armor,
			Regen,
			Luck,
			Cooldown,
			JumpPower,
			CurseReduction,
			Bleed,
			Collapse,
			Atg,
			PlasmaShrimp,
			Ukulele,
			Polylute,
			StickyBomb,
			ChargedPerforator,
			MeatHook,
			Chronobauble,
			Tentabauble,
			LeechingSeed,
			CritHeal,
			Explosion,
			Stun,
			FlatReduction,
			SprintSpeed,
			OnHit
		}

		internal sealed class StatBank
		{
			public float Health;

			public float Shield;

			public float Damage;

			public float MoveSpeed;

			public float AttackSpeed;

			public float CritChance;

			public float CritDamage;

			public float Armor;

			public float Regen;

			public float Luck;

			public float Cooldown;

			public float JumpPower;

			public float CurseReduction;

			public int ExtraJumps;

			public float Bleed;

			public float Collapse;

			public float Atg;

			public float PlasmaShrimp;

			public float Ukulele;

			public float Polylute;

			public float StickyBomb;

			public float ChargedPerforator;

			public float MeatHook;

			public float Chronobauble;

			public float Tentabauble;

			public float LeechingSeed;

			public float CritHeal;

			public float Explosion;

			public float Stun;

			public float FlatReduction;

			public float SprintSpeed;

			public void Write(NetworkWriter writer)
			{
				writer.Write(Health);
				writer.Write(Shield);
				writer.Write(Damage);
				writer.Write(MoveSpeed);
				writer.Write(AttackSpeed);
				writer.Write(CritChance);
				writer.Write(CritDamage);
				writer.Write(Armor);
				writer.Write(Regen);
				writer.Write(Luck);
				writer.Write(Cooldown);
				writer.Write(JumpPower);
				writer.Write(CurseReduction);
				writer.Write(ExtraJumps);
				writer.Write(Bleed);
				writer.Write(Collapse);
				writer.Write(Atg);
				writer.Write(PlasmaShrimp);
				writer.Write(Ukulele);
				writer.Write(Polylute);
				writer.Write(StickyBomb);
				writer.Write(ChargedPerforator);
				writer.Write(MeatHook);
				writer.Write(Chronobauble);
				writer.Write(Tentabauble);
				writer.Write(LeechingSeed);
				writer.Write(CritHeal);
				writer.Write(Explosion);
				writer.Write(Stun);
				writer.Write(FlatReduction);
				writer.Write(SprintSpeed);
			}

			public void CopyFrom(StatBank source)
			{
				Health = source.Health;
				Shield = source.Shield;
				Damage = source.Damage;
				MoveSpeed = source.MoveSpeed;
				AttackSpeed = source.AttackSpeed;
				CritChance = source.CritChance;
				CritDamage = source.CritDamage;
				Armor = source.Armor;
				Regen = source.Regen;
				Luck = source.Luck;
				Cooldown = source.Cooldown;
				JumpPower = source.JumpPower;
				CurseReduction = source.CurseReduction;
				ExtraJumps = source.ExtraJumps;
				Bleed = source.Bleed;
				Collapse = source.Collapse;
				Atg = source.Atg;
				PlasmaShrimp = source.PlasmaShrimp;
				Ukulele = source.Ukulele;
				Polylute = source.Polylute;
				StickyBomb = source.StickyBomb;
				ChargedPerforator = source.ChargedPerforator;
				MeatHook = source.MeatHook;
				Chronobauble = source.Chronobauble;
				Tentabauble = source.Tentabauble;
				LeechingSeed = source.LeechingSeed;
				CritHeal = source.CritHeal;
				Explosion = source.Explosion;
				Stun = source.Stun;
				FlatReduction = source.FlatReduction;
				SprintSpeed = source.SprintSpeed;
			}

			public void Read(NetworkReader reader)
			{
				Health = reader.ReadSingle();
				Shield = reader.ReadSingle();
				Damage = reader.ReadSingle();
				MoveSpeed = reader.ReadSingle();
				AttackSpeed = reader.ReadSingle();
				CritChance = reader.ReadSingle();
				CritDamage = reader.ReadSingle();
				Armor = reader.ReadSingle();
				Regen = reader.ReadSingle();
				Luck = reader.ReadSingle();
				Cooldown = reader.ReadSingle();
				JumpPower = reader.ReadSingle();
				CurseReduction = reader.ReadSingle();
				ExtraJumps = reader.ReadInt32();
				Bleed = reader.ReadSingle();
				Collapse = reader.ReadSingle();
				Atg = reader.ReadSingle();
				PlasmaShrimp = reader.ReadSingle();
				Ukulele = reader.ReadSingle();
				Polylute = reader.ReadSingle();
				StickyBomb = reader.ReadSingle();
				ChargedPerforator = reader.ReadSingle();
				MeatHook = reader.ReadSingle();
				Chronobauble = reader.ReadSingle();
				Tentabauble = reader.ReadSingle();
				LeechingSeed = reader.ReadSingle();
				CritHeal = reader.ReadSingle();
				Explosion = reader.ReadSingle();
				Stun = reader.ReadSingle();
				FlatReduction = reader.ReadSingle();
				SprintSpeed = reader.ReadSingle();
			}
		}

		private readonly struct GainLine
		{
			public readonly string Text;

			public readonly string Style;

			public readonly string ColorHex;

			public GainLine(string text, string style, string colorHex = null)
			{
				Text = text;
				Style = style;
				ColorHex = colorHex;
			}
		}

		private sealed class Floater
		{
			public RectTransform Rect;

			public HGTextMeshProUGUI Label;

			public Vector2 Start;

			public float Born;
		}

		private sealed class BankMessage : MessageBase
		{
			public NetworkInstanceId MasterId;

			private readonly StatBank _bank = new StatBank();

			public StatBank Bank => _bank;

			public void Load(StatBank source)
			{
				_bank.CopyFrom(source);
			}

			public override void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(MasterId);
				_bank.Write(writer);
			}

			public override void Deserialize(NetworkReader reader)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				MasterId = reader.ReadNetworkId();
				_bank.Read(reader);
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Action<SceneDirector, DirectorCardCategorySelection> <0>__OnGenerateInteractableCards;

			public static hook_Spawn <1>__OnInteractableSpawn;

			public static hook_DropRewards <2>__OnDropRewards;

			public static Action<DamageReport> <3>__OnCharacterDeathServer;

			public static hook_OnHitEnemy <4>__OnHitEnemy;

			public static hook_TakeDamage <5>__OnTakeDamage;

			public static hook_RecalculateStats <6>__OnRecalculateStats;

			public static hook_OnUserAdded <7>__OnUserAdded;

			public static hook_OnStartClient <8>__OnStartClient;

			public static Action<Run> <9>__OnRunDestroy;

			public static Action<Run, GameEndingDef> <10>__OnServerGameOver;

			public static NetworkMessageDelegate <11>__OnBankMessage;
		}

		private static readonly StatKind[] CoreStats = new StatKind[16]
		{
			StatKind.Health,
			StatKind.Shield,
			StatKind.Damage,
			StatKind.MoveSpeed,
			StatKind.AttackSpeed,
			StatKind.CritChance,
			StatKind.CritDamage,
			StatKind.Armor,
			StatKind.Regen,
			StatKind.Luck,
			StatKind.Cooldown,
			StatKind.JumpPower,
			StatKind.CurseReduction,
			StatKind.FlatReduction,
			StatKind.SprintSpeed,
			StatKind.OnHit
		};

		private static readonly StatKind[] OnHitStats = new StatKind[15]
		{
			StatKind.Bleed,
			StatKind.Collapse,
			StatKind.Atg,
			StatKind.PlasmaShrimp,
			StatKind.Ukulele,
			StatKind.Polylute,
			StatKind.StickyBomb,
			StatKind.ChargedPerforator,
			StatKind.MeatHook,
			StatKind.Chronobauble,
			StatKind.Tentabauble,
			StatKind.LeechingSeed,
			StatKind.CritHeal,
			StatKind.Explosion,
			StatKind.Stun
		};

		private static readonly Dictionary<int, StatBank> Banks = new Dictionary<int, StatBank>();

		private static readonly Dictionary<NetworkInstanceId, StatBank> PendingBanks = new Dictionary<NetworkInstanceId, StatBank>();

		private static bool _bankHandlersRegistered;

		private static readonly List<Floater> Floaters = new List<Floater>();

		private static readonly Vector3[] BarCorners = (Vector3[])(object)new Vector3[4];

		private const short BankMessageId = 24158;

		private const float FloatDuration = 2.5f;

		private const float FloatRise = 28f;

		private const float BossExtraJumpChance = 25f;

		private static ConfigEntry<float> _gainPercent;

		private static ConfigEntry<float> _normalWeight;

		private static ConfigEntry<float> _eliteWeight;

		private static ConfigEntry<float> _championWeight;

		private static ConfigEntry<float> _bossWeight;

		private static ConfigEntry<float> _eliteBossWeight;

		private static Canvas _floatCanvas;

		private static TMP_FontAsset _gameFont;

		private static TMP_StyleSheet _gameStyleSheet;

		private static readonly Color UnmappedGainColor = new Color(0.96f, 0.9f, 0.62f, 1f);

		private static Hook _lookingGlassHook;

		private static Type _lookingGlassType;

		private static readonly Dictionary<int, float> BaseSprint = new Dictionary<int, float>();

		private static readonly Action<CharacterBody, int> SetMaxJumpCount = (Action<CharacterBody, int>)Delegate.CreateDelegate(typeof(Action<CharacterBody, int>), typeof(CharacterBody).GetProperty("maxJumpCount").GetSetMethod(nonPublic: true));

		private static bool Active => ArtifactRegistry.GetEffectLevel(ArtifactRegistry.Amalgamation) > 0;

		public static void Bind(ConfigFile config)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			_gainPercent = config.Bind<float>("Amalgamation", "GainPercent", 100f, new ConfigDescription("Percent of the base stat gained from a kill.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>()));
			_normalWeight = config.Bind<float>("Amalgamation", "NormalWeight", 1f, new ConfigDescription("Gain weight for a normal enemy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			_eliteWeight = config.Bind<float>("Amalgamation", "EliteWeight", 3f, new ConfigDescription("Gain weight for an elite.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			_championWeight = config.Bind<float>("Amalgamation", "ChampionWeight", 5f, new ConfigDescription("Gain weight for a champion.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			_bossWeight = config.Bind<float>("Amalgamation", "BossWeight", 8f, new ConfigDescription("Gain weight for a boss.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			_eliteBossWeight = config.Bind<float>("Amalgamation", "EliteBossWeight", 10f, new ConfigDescription("Gain weight for an elite boss.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
		}

		public static void RegisterSettings()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_gainPercent, Slider(0f, 1000f, 5f, "{0:0}%", "Stat gain", "Percent of the base stat gained from a kill.")));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_normalWeight, Slider(0f, 100f, 0.5f, "{0:0.0}", "Normal weight", "Gain weight for a normal enemy.")));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_eliteWeight, Slider(0f, 100f, 0.5f, "{0:0.0}", "Elite weight", "Gain weight for an elite.")));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_championWeight, Slider(0f, 100f, 0.5f, "{0:0.0}", "Champion weight", "Gain weight for a champion.")));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_bossWeight, Slider(0f, 100f, 0.5f, "{0:0.0}", "Boss weight", "Gain weight for a boss.")));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_eliteBossWeight, Slider(0f, 100f, 0.5f, "{0:0.0}", "Elite boss weight", "Gain weight for an elite boss.")));
		}

		private static StepSliderConfig Slider(float min, float max, float step, string format, string name, string description)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			return new StepSliderConfig
			{
				min = min,
				max = max,
				increment = step,
				FormatString = format,
				name = name,
				description = description,
				category = "Amalgamation"
			};
		}

		private static float ConfigOr(ConfigEntry<float> entry, float fallback)
		{
			return Mathf.Max(0f, entry?.Value ?? fallback);
		}

		public static void Hooks()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0119: 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_0124: Expected O, but got Unknown
			SceneDirector.onGenerateInteractableCardSelection += OnGenerateInteractableCards;
			object obj = <>O.<1>__OnInteractableSpawn;
			if (obj == null)
			{
				hook_Spawn val = OnInteractableSpawn;
				<>O.<1>__OnInteractableSpawn = val;
				obj = (object)val;
			}
			InteractableSpawnCard.Spawn += (hook_Spawn)obj;
			object obj2 = <>O.<2>__OnDropRewards;
			if (obj2 == null)
			{
				hook_DropRewards val2 = OnDropRewards;
				<>O.<2>__OnDropRewards = val2;
				obj2 = (object)val2;
			}
			BossGroup.DropRewards += (hook_DropRewards)obj2;
			GlobalEventManager.onCharacterDeathServer += OnCharacterDeathServer;
			object obj3 = <>O.<4>__OnHitEnemy;
			if (obj3 == null)
			{
				hook_OnHitEnemy val3 = AmalgamationOnHit.OnHitEnemy;
				<>O.<4>__OnHitEnemy = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj3;
			object obj4 = <>O.<5>__OnTakeDamage;
			if (obj4 == null)
			{
				hook_TakeDamage val4 = OnTakeDamage;
				<>O.<5>__OnTakeDamage = val4;
				obj4 = (object)val4;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj4;
			object obj5 = <>O.<6>__OnRecalculateStats;
			if (obj5 == null)
			{
				hook_RecalculateStats val5 = OnRecalculateStats;
				<>O.<6>__OnRecalculateStats = val5;
				obj5 = (object)val5;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj5;
			object obj6 = <>O.<7>__OnUserAdded;
			if (obj6 == null)
			{
				hook_OnUserAdded val6 = OnUserAdded;
				<>O.<7>__OnUserAdded = val6;
				obj6 = (object)val6;
			}
			Run.OnUserAdded += (hook_OnUserAdded)obj6;
			object obj7 = <>O.<8>__OnStartClient;
			if (obj7 == null)
			{
				hook_OnStartClient val7 = OnStartClient;
				<>O.<8>__OnStartClient = val7;
				obj7 = (object)val7;
			}
			NetworkManagerSystem.OnStartClient += (hook_OnStartClient)obj7;
			Run.onRunDestroyGlobal += OnRunDestroy;
			Run.onServerGameOver += OnServerGameOver;
			TryHookLookingGlass();
			RegisterBankHandlers();
		}

		public static void Unhooks()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0119: 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_0124: Expected O, but got Unknown
			SceneDirector.onGenerateInteractableCardSelection -= OnGenerateInteractableCards;
			object obj = <>O.<1>__OnInteractableSpawn;
			if (obj == null)
			{
				hook_Spawn val = OnInteractableSpawn;
				<>O.<1>__OnInteractableSpawn = val;
				obj = (object)val;
			}
			InteractableSpawnCard.Spawn -= (hook_Spawn)obj;
			object obj2 = <>O.<2>__OnDropRewards;
			if (obj2 == null)
			{
				hook_DropRewards val2 = OnDropRewards;
				<>O.<2>__OnDropRewards = val2;
				obj2 = (object)val2;
			}
			BossGroup.DropRewards -= (hook_DropRewards)obj2;
			GlobalEventManager.onCharacterDeathServer -= OnCharacterDeathServer;
			object obj3 = <>O.<4>__OnHitEnemy;
			if (obj3 == null)
			{
				hook_OnHitEnemy val3 = AmalgamationOnHit.OnHitEnemy;
				<>O.<4>__OnHitEnemy = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnHitEnemy -= (hook_OnHitEnemy)obj3;
			object obj4 = <>O.<5>__OnTakeDamage;
			if (obj4 == null)
			{
				hook_TakeDamage val4 = OnTakeDamage;
				<>O.<5>__OnTakeDamage = val4;
				obj4 = (object)val4;
			}
			HealthComponent.TakeDamage -= (hook_TakeDamage)obj4;
			object obj5 = <>O.<6>__OnRecalculateStats;
			if (obj5 == null)
			{
				hook_RecalculateStats val5 = OnRecalculateStats;
				<>O.<6>__OnRecalculateStats = val5;
				obj5 = (object)val5;
			}
			CharacterBody.RecalculateStats -= (hook_RecalculateStats)obj5;
			object obj6 = <>O.<7>__OnUserAdded;
			if (obj6 == null)
			{
				hook_OnUserAdded val6 = OnUserAdded;
				<>O.<7>__OnUserAdded = val6;
				obj6 = (object)val6;
			}
			Run.OnUserAdded -= (hook_OnUserAdded)obj6;
			object obj7 = <>O.<8>__OnStartClient;
			if (obj7 == null)
			{
				hook_OnStartClient val7 = OnStartClient;
				<>O.<8>__OnStartClient = val7;
				obj7 = (object)val7;
			}
			NetworkManagerSystem.OnStartClient -= (hook_OnStartClient)obj7;
			Run.onRunDestroyGlobal -= OnRunDestroy;
			Run.onServerGameOver -= OnServerGameOver;
			Banks.Clear();
			PendingBanks.Clear();
			BaseSprint.Clear();
			ClearFloaters();
			Hook lookingGlassHook = _lookingGlassHook;
			if (lookingGlassHook != null)
			{
				lookingGlassHook.Dispose();
			}
			_lookingGlassHook = null;
		}

		public static void Tick()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			ApplyPendingBanks();
			if (Floaters.Count == 0)
			{
				return;
			}
			float unscaledTime = Time.unscaledTime;
			for (int num = Floaters.Count - 1; num >= 0; num--)
			{
				Floater floater = Floaters[num];
				if (!Object.op_Implicit((Object)(object)floater.Rect))
				{
					Floaters.RemoveAt(num);
				}
				else
				{
					float num2 = Mathf.Clamp01((unscaledTime - floater.Born) / 2.5f);
					floater.Rect.anchoredPosition = floater.Start + new Vector2(0f, 28f * num2);
					if (Object.op_Implicit((Object)(object)floater.Label))
					{
						Color color = ((Graphic)floater.Label).color;
						color.a = 1f - num2;
						((Graphic)floater.Label).color = color;
					}
					if (num2 >= 1f)
					{
						Object.Destroy((Object)(object)((Component)floater.Rect).gameObject);
						Floaters.RemoveAt(num);
					}
				}
			}
		}

		private static void OnRunDestroy(Run run)
		{
			Banks.Clear();
			PendingBanks.Clear();
			BaseSprint.Clear();
		}

		private static void OnServerGameOver(Run run, GameEndingDef ending)
		{
			Banks.Clear();
			PendingBanks.Clear();
			BaseSprint.Clear();
		}

		private static void OnGenerateInteractableCards(SceneDirector director, DirectorCardCategorySelection selection)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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)
			if (!Active || selection?.categories == null)
			{
				return;
			}
			for (int i = 0; i < selection.categories.Length; i++)
			{
				Category val = selection.categories[i];
				if (IsChestCategory(val.name))
				{
					val.cards = Array.Empty<DirectorCard>();
					val.selectionWeight = 0f;
					selection.categories[i] = val;
				}
				else
				{
					if (val.cards == null || val.cards.Length == 0)
					{
						continue;
					}
					List<DirectorCard> list = new List<DirectorCard>(val.cards.Length);
					for (int j = 0; j < val.cards.Length; j++)
					{
						DirectorCard val2 = val.cards[j];
						if (!IsChestCard(val2) && !SacrificeWouldRemove(val2))
						{
							list.Add(val2);
						}
					}
					val.cards = list.ToArray();
					selection.categories[i] = val;
				}
			}
		}

		private static bool IsChestCategory(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return false;
			}
			return name.IndexOf("Chest", StringComparison.OrdinalIgnoreCase) >= 0;
		}

		private static bool IsChestCard(DirectorCard card)
		{
			if ((Object)(object)card?.spawnCard == (Object)null)
			{
				return false;
			}
			string name = ((Object)card.spawnCard).name;
			if (string.IsNullOrEmpty(name))
			{
				return false;
			}
			return IsRemovedSpawnName(name);
		}

		private static bool IsRemovedSpawnName(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return false;
			}
			return name.IndexOf("Chest", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("MultiShop", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("TripleShop", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("FreeChest", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("EquipmentBarrel", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("LunarPod", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("Lockbox", StringComparison.OrdinalIgnoreCase) >= 0;
		}

		private static bool SacrificeWouldRemove(DirectorCard card)
		{
			SpawnCard obj = card?.spawnCard;
			InteractableSpawnCard val = (InteractableSpawnCard)(object)((obj is InteractableSpawnCard) ? obj : null);
			if (!Object.op_Implicit((Object)(object)val) && card != null)
			{
				SpawnCard spawnCard = card.GetSpawnCard();
				val = (InteractableSpawnCard)(object)((spawnCard is InteractableSpawnCard) ? spawnCard : null);
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			return val.skipSpawnWhenSacrificeArtifactEnabled || val.weightScalarWhenSacrificeArtifactEnabled <= 0f;
		}

		private static void OnInteractableSpawn(orig_Spawn orig, InteractableSpawnCard self, Vector3 position, Quaternion rotation, DirectorSpawnRequest directorSpawnRequest, ref SpawnResult result)
		{
			//IL_0047: 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)
			if (Active && Object.op_Implicit((Object)(object)self) && (self.skipSpawnWhenSacrificeArtifactEnabled || self.weightScalarWhenSacrificeArtifactEnabled <= 0f || IsRemovedSpawnName(((Object)self).name)))
			{
				result.success = false;
			}
			else
			{
				orig.Invoke(self, position, rotation, directorSpawnRequest, ref result);
			}
		}

		private static void OnDropRewards(orig_DropRewards orig, BossGroup self)
		{
			if (!Active)
			{
				orig.Invoke(self);
			}
		}

		private static void OnCharacterDeathServer(DamageReport report)
		{
			if (!NetworkServer.active || !Active || (Object)(object)report?.victimBody == (Object)null || !IsEnemy(report.victimBody))
			{
				return;
			}
			CharacterBody val = ResolveBeneficiary(report);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			CharacterMaster master = val.master;
			if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.playerCharacterMasterController))
			{
				float num = GetEnemyWeight(report.victimBody);
				int effectLevel = ArtifactRegistry.GetEffectLevel(ArtifactRegistry.Amalgamation);
				if (effectLevel >= 2)
				{
					num *= (float)effectLevel;
				}
				StatBank orCreateBank = GetOrCreateBank(master);
				GainLine gain = ApplyRandomUpgrade(orCreateBank, master, num);
				ShowGain(master, gain, 0);
				if (report.victimBody.isBoss && Util.CheckRoll(25f, master.luck, (CharacterMaster)null))
				{
					orCreateBank.ExtraJumps++;
					ShowGain(master, new GainLine("+1 Jump", "cIsUtility"), 1);
				}
				val.MarkAllStatsDirty();
				SendBank(master, null);
			}
		}

		private static GainLine ApplyRandomUpgrade(StatBank bank, CharacterMaster master, float weight)
		{
			StatKind statKind = CoreStats[Random.Range(0, CoreStats.Length)];
			if (statKind == StatKind.OnHit)
			{
				statKind = OnHitStats[Random.Range(0, OnHitStats.Length)];
			}
			weight *= ConfigOr(_gainPercent, 100f) / 100f;
			switch (statKind)
			{
			case StatKind.Health:
				bank.Health += 7f * weight;
				return new GainLine(FormatFlat("Health", 7f * weight), LookingGlassStyle(statKind));
			case StatKind.Shield:
				bank.Shield += 3f * weight;
				return new GainLine(FormatFlat("Shield", 3f * weight), LookingGlassStyle(statKind));
			case StatKind.Damage:
				bank.Damage += 0.3f * weight;
				return new GainLine(FormatFlat("Damage", 0.3f * weight), LookingGlassStyle(statKind));
			case StatKind.MoveSpeed:
				bank.MoveSpeed += 0.025f * weight;
				return new GainLine(FormatFlat("Move Speed", 0.025f * weight), LookingGlassStyle(statKind));
			case StatKind.AttackSpeed:
				bank.AttackSpeed += 0.02f * weight;
				return new GainLine($"+{0.02f * weight * 100f:0.#}% Attack Speed", LookingGlassStyle(statKind));
			case StatKind.CritChance:
				bank.CritChance += 0.15f * weight;
				return new GainLine($"+{0.15f * weight:0.##}% Crit Chance", LookingGlassStyle(statKind));
			case StatKind.CritDamage:
				bank.CritDamage += 0.03f * weight;
				return new GainLine(FormatFlat("Crit Damage", 0.03f * weight), LookingGlassStyle(statKind));
			case StatKind.Armor:
				bank.Armor += 1.25f * weight;
				return new GainLine(FormatFlat("Armor", 1.25f * weight), LookingGlassStyle(statKind));
			case StatKind.Regen:
				bank.Regen += 0.25f * weight;
				return new GainLine(FormatFlat("Regen", 0.25f * weight), LookingGlassStyle(statKind));
			case StatKind.Luck:
			{
				float num = 0.015f * weight;
				bank.Luck += num;
				if (Object.op_Implicit((Object)(object)master))
				{
					master.luck += num;
				}
				return new GainLine(FormatFlat("Luck", num), LookingGlassStyle(statKind));
			}
			case StatKind.Cooldown:
				bank.Cooldown += 0.008f * weight;
				return new GainLine($"+{0.008f * weight * 100f:0.#}% Cooldown Reduction", LookingGlassStyle(statKind));
			case StatKind.JumpPower:
				bank.JumpPower += 0.03f * weight;
				return new GainLine(FormatFlat("Jump Power", 0.03f * weight), LookingGlassStyle(statKind));
			case StatKind.CurseReduction:
				bank.CurseReduction += 0.005f * weight;
				return new GainLine(FormatFlat("Curse Reduction", 0.005f * weight), null, HexItemColor());
			case StatKind.Bleed:
				bank.Bleed += 0.5f * weight;
				return PercentGain("Bleed", 0.5f * weight);
			case StatKind.Collapse:
				bank.Collapse += 0.1f * weight;
				return PercentGain("Collapse", 0.1f * weight);
			case StatKind.Atg:
				bank.Atg += 0.2f * weight;
				return PercentGain("ATG", 0.2f * weight);
			case StatKind.PlasmaShrimp:
				bank.PlasmaShrimp += 1f * weight;
				return PercentGain("Plasma Shrimp", 1f * weight);
			case StatKind.Ukulele:
				bank.Ukulele += 2f * weight;
				return PercentGain("Ukulele", 2f * weight);
			case StatKind.Polylute:
				bank.Polylute += 1f * weight;
				return PercentGain("Polylute", 1f * weight);
			case StatKind.StickyBomb:
				bank.StickyBomb += 0.5f * weight;
				return PercentGain("Sticky Bomb", 0.5f * weight);
			case StatKind.ChargedPerforator:
				bank.ChargedPerforator += 1f * weight;
				return PercentGain("Charged Perforator", 1f * weight);
			case StatKind.MeatHook:
				bank.MeatHook += 0.75f * weight;
				return PercentGain("Meat Hook", 0.75f * weight);
			case StatKind.Chronobauble:
				bank.Chronobauble += 5f * weight;
				return PercentGain("Chronobauble", 5f * weight, "cIsUtility");
			case StatKind.Tentabauble:
				bank.Tentabauble += 0.5f * weight;
				return PercentGain("Tentabauble", 0.5f * weight, "cIsUtility");
			case StatKind.LeechingSeed:
				bank.LeechingSeed += 2f * weight;
				return PercentGain("Leech", 2f * weight, "cIsHealing");
			case StatKind.CritHeal:
				bank.CritHeal += 0.8f * weight;
				return new GainLine(FormatFlat("Heal on Crit", 0.8f * weight), "cIsHealing");
			case StatKind.Explosion:
				bank.Explosion += 1f * weight;
				return PercentGain("Explosion", 1f * weight);
			case StatKind.Stun:
				bank.Stun += 0.5f * weight;
				return PercentGain("Stun", 0.5f * weight, "cIsUtility");
			case StatKind.FlatReduction:
				bank.FlatReduction += 0.5f * weight;
				return new GainLine(FormatFlat("Damage Reduction", 0.5f * weight), "cIsHealing");
			case StatKind.SprintSpeed:
				bank.SprintSpeed += 0.025f * weight;
				return new GainLine($"+{0.025f * weight * 100f:0.#}% Sprint Speed", "cIsUtility");
			default:
				return default(GainLine);
			}
		}

		private static string LookingGlassStyle(StatKind kind)
		{
			switch (kind)
			{
			case StatKind.Health:
			case StatKind.Shield:
			case StatKind.Armor:
			case StatKind.Regen:
			case StatKind.LeechingSeed:
				return "cIsHealing";
			case StatKind.Damage:
			case StatKind.AttackSpeed:
			case StatKind.CritChance:
			case StatKind.CritDamage:
				return "cIsDamage";
			case StatKind.MoveSpeed:
			case StatKind.Luck:
			case StatKind.Cooldown:
			case StatKind.JumpPower:
			case StatKind.Chronobauble:
			case StatKind.Tentabauble:
				return "cIsUtility";
			default:
				return null;
			}
		}

		private static string HexItemColor()
		{
			string colorHexString = ColorCatalog.GetColorHexString((ColorIndex)35);
			return string.IsNullOrEmpty(colorHexString) ? "D0F820" : colorHexString.TrimStart('#');
		}

		private static GainLine PercentGain(string name, float percent, string style = "cIsDamage")
		{
			return new GainLine($"+{percent:0.##}% {name}", style);
		}

		private static string FormatFlat(string name, float amount)
		{
			return $"+{amount:0.##} {name}";
		}

		private static void ShowGain(CharacterMaster master, GainLine gain, int slot)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)master) && !string.IsNullOrEmpty(gain.Text) && TryGetPointAboveExpBar(master, out var point))
			{
				point.y += 12f * (float)slot;
				GameObject val = new GameObject("AmalgamationGain");
				val.transform.SetParent(((Component)_floatCanvas).transform, false);
				RectTransform val2 = val.AddComponent<RectTransform>();
				val2.sizeDelta = new Vector2(460f, 18f);
				val2.anchoredPosition = point;
				HGTextMeshProUGUI val3 = val.AddComponent<HGTextMeshProUGUI>();
				ApplyGameText(val3);
				if (!string.IsNullOrEmpty(gain.Style))
				{
					((TMP_Text)val3).text = "<style=" + gain.Style + ">" + gain.Text + "</style>";
				}
				else if (!string.IsNullOrEmpty(gain.ColorHex))
				{
					((TMP_Text)val3).text = "<color=#" + gain.ColorHex + ">" + gain.Text + "</color>";
				}
				else
				{
					((TMP_Text)val3).text = gain.Text;
				}
				((TMP_Text)val3).fontSize = 14f;
				((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
				ApplyHealthBarSlant(val3, master);
				((TMP_Text)val3).fontSize = 14f;
				((Graphic)val3).color = ((string.IsNullOrEmpty(gain.Style) && string.IsNullOrEmpty(gain.ColorHex)) ? UnmappedGainColor : Color.white);
				((TMP_Text)val3).richText = true;
				((Graphic)val3).raycastTarget = false;
				((TMP_Text)val3).enableWordWrapping = false;
				Floaters.Add(new Floater
				{
					Rect = val2,
					Label = val3,
					Start = point,
					Born = Time.unscaledTime
				});
			}
		}

		private static void ApplyHealthBarSlant(HGTextMeshProUGUI label, CharacterMaster master)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Invalid comparison between Unknown and I4
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			ReadOnlyCollection<HUD> readOnlyInstanceList = HUD.readOnlyInstanceList;
			for (int i = 0; i < readOnlyInstanceList.Count; i++)
			{
				HUD val = readOnlyInstanceList[i];
				if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val.targetMaster != (Object)(object)master || !Object.op_Implicit((Object)(object)val.healthBar))
				{
					continue;
				}
				RectTransform component = ((Component)val.healthBar).GetComponent<RectTransform>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.GetWorldCorners(BarCorners);
					Canvas componentInParent = ((Component)component).GetComponentInParent<Canvas>();
					Camera val2 = null;
					if (Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.renderMode > 0)
					{
						val2 = componentInParent.worldCamera;
					}
					Vector2 val3 = RectTransformUtility.WorldToScreenPoint(val2, BarCorners[0]);
					Vector2 val4 = RectTransformUtility.WorldToScreenPoint(val2, BarCorners[3]);
					Vector2 val5 = val4 - val3;
					if (!(((Vector2)(ref val5)).sqrMagnitude < 1f))
					{
						float num = Mathf.Atan2(val5.y, val5.x) * 57.29578f;
						((Transform)((TMP_Text)label).rectTransform).localRotation = Quaternion.Euler(0f, 0f, num);
					}
				}
				break;
			}
		}

		private static bool TryGetPointAboveExpBar(CharacterMaster master, out Vector2 point)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Invalid comparison between Unknown and I4
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			point = default(Vector2);
			ReadOnlyCollection<HUD> readOnlyInstanceList = HUD.readOnlyInstanceList;
			HUD val = null;
			for (int i = 0; i < readOnlyInstanceList.Count; i++)
			{
				HUD val2 = readOnlyInstanceList[i];
				if (Object.op_Implicit((Object)(object)val2) && (Object)(object)val2.targetMaster == (Object)(object)master && (Object.op_Implicit((Object)(object)val2.expBar) || Object.op_Implicit((Object)(object)val2.healthBar)))
				{
					val = val2;
					break;
				}
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			RectTransform val3 = (Object.op_Implicit((Object)(object)val.expBar) ? ((Component)val.expBar).GetComponent<RectTransform>() : null);
			if (!Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val.healthBar))
			{
				val3 = ((Component)val.healthBar).GetComponent<RectTransform>();
			}
			if (!Object.op_Implicit((Object)(object)val3))
			{
				return false;
			}
			val3.GetWorldCorners(BarCorners);
			Vector3 val4 = (BarCorners[1] + BarCorners[2]) * 0.5f;
			Canvas componentInParent = ((Component)val3).GetComponentInParent<Canvas>();
			Camera val5 = null;
			if (Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.renderMode > 0)
			{
				val5 = componentInParent.worldCamera;
			}
			Vector2 val6 = RectTransformUtility.WorldToScreenPoint(val5, val4);
			EnsureFloatCanvas();
			RectTransform component = ((Component)_floatCanvas).GetComponent<RectTransform>();
			if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(component, val6, (Camera)null, ref point))
			{
				return false;
			}
			point.y += 13f;
			return true;
		}

		private static void EnsureFloatCanvas()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_floatCanvas))
			{
				GameObject val = new GameObject("AmalgamationGainCanvas");
				Object.DontDestroyOnLoad((Object)(object)val);
				_floatCanvas = val.AddComponent<Canvas>();
				_floatCanvas.renderMode = (RenderMode)0;
				_floatCanvas.sortingOrder = 4500;
				CanvasScaler val2 = val.AddComponent<CanvasScaler>();
				val2.uiScaleMode = (ScaleMode)1;
				val2.referenceResolution = new Vector2(1920f, 1080f);
				val2.matchWidthOrHeight = 0.5f;
			}
		}

		private static void ApplyGameText(HGTextMeshProUGUI label)
		{
			if (!Object.op_Implicit((Object)(object)_gameFont) || !Object.op_Implicit((Object)(object)_gameStyleSheet))
			{
				HGTextMeshProUGUI[] array = Resources.FindObjectsOfTypeAll<HGTextMeshProUGUI>();
				foreach (HGTextMeshProUGUI val in array)
				{
					if (Object.op_Implicit((Object)(object)val) && !((Object)(object)val == (Object)(object)label))
					{
						if (!Object.op_Implicit((Object)(object)_gameFont) && Object.op_Implicit((Object)(object)((TMP_Text)val).font))
						{
							_gameFont = ((TMP_Text)val).font;
						}
						if (!Object.op_Implicit((Object)(object)_gameStyleSheet) && Object.op_Implicit((Object)(object)((TMP_Text)val).styleSheet))
						{
							_gameStyleSheet = ((TMP_Text)val).styleSheet;
						}
						if (Object.op_Implicit((Object)(object)_gameFont) && Object.op_Implicit((Object)(object)_gameStyleSheet))
						{
							break;
						}
					}
				}
			}
			if (Object.op_Implicit((Object)(object)_gameFont))
			{
				((TMP_Text)label).font = _gameFont;
			}
			if (Object.op_Implicit((Object)(object)_gameStyleSheet))
			{
				((TMP_Text)label).styleSheet = _gameStyleSheet;
			}
		}

		private static void ClearFloaters()
		{
			for (int i = 0; i < Floaters.Count; i++)
			{
				if (Object.op_Implicit((Object)(object)Floaters[i].Rect))
				{
					Object.Destroy((Object)(object)((Component)Floaters[i].Rect).gameObject);
				}
			}
			Floaters.Clear();
			if (Object.op_Implicit((Object)(object)_floatCanvas))
			{
				Object.Destroy((Object)(object)((Component)_floatCanvas).gameObject);
				_floatCanvas = null;
			}
		}

		private static void TryHookLookingGlass()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			if (_lookingGlassHook != null)
			{
				return;
			}
			try
			{
				_lookingGlassType = FindLookingGlassType();
				MethodInfo methodInfo = _lookingGlassType?.GetMethod("GenerateStatsText", BindingFlags.Static | BindingFlags.NonPublic);
				if (!(methodInfo == null))
				{
					_lookingGlassHook = new Hook((MethodBase)methodInfo, (Delegate)new Func<Func<string>, string>(OnLookingGlassStats));
				}
			}
			catch (Exception ex)
			{
				Log.Warning("LookingGlass stat tie-in was not installed: " + ex.Message, "C:\\Users\\ebez2\\OneDrive\\Desktop\\Mods & Mod Making Tools\\Risk of Rain 2\\EdsMods\\EdsArtifacts\\AmalgamationArtifact.cs", 986);
			}
		}

		private static Type FindLookingGlassType()
		{
			Type type = Type.GetType("LookingGlass.StatsDisplay.StatsDisplayClass, LookingGlass");
			if (type != null)
			{
				return type;
			}
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			for (int i = 0; i < assemblies.Length; i++)
			{
				if (assemblies[i].GetName().Name == "LookingGlass")
				{
					return assemblies[i].GetType("LookingGlass.StatsDisplay.StatsDisplayClass");
				}
			}
			return null;
		}

		private static string OnLookingGlassStats(Func<string> orig)
		{
			CharacterBody lookingGlassBody = GetLookingGlassBody();
			string text = InsertCritDamage(orig(), lookingGlassBody);
			if (!Object.op_Implicit((Object)(object)lookingGlassBody) || !Object.op_Implicit((Object)(object)lookingGlassBody.master) || !Banks.TryGetValue(((Object)lookingGlassBody.master).GetInstanceID(), out var value))
			{
				return text;
			}
			bool flag = IsLookingGlassScoreboardOpen();
			if (flag)
			{
				text = ExpandAmalgamationStats(text, lookingGlassBody, value);
				if (value.Bleed > 0.0001f)
				{
					text = Regex.Replace(text, "(?m)^[^\\n]*Bleed Chance\\s*:[^\\n]*\\n?", "");
				}
			}
			return AppendMissingBonuses(text, lookingGlassBody, value, flag);
		}

		private static string InsertCritDamage(string text, CharacterBody body)
		{
			if (string.IsNullOrEmpty(text) || text.IndexOf("Crit Damage", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return text;
			}
			Match match = Regex.Match(text, "^.*Crit Chance:.*$", RegexOptions.Multiline);
			if (!match.Success)
			{
				return text;
			}
			float num = (Object.op_Implicit((Object)(object)body) ? body.critMultiplier : 2f);
			string text2 = $"×{num:0.##}";
			Match match2 = Regex.Match(match.Value, "style=(\\w+)");
			string text3 = (match2.Success ? ("Crit Damage: <style=" + match2.Groups[1].Value + ">" + text2 + "</style>") : ("Crit Damage: " + text2));
			string text4 = (text.Contains("\r\n") ? "\r\n" : "\n");
			return text.Insert(match.Index + match.Length, text4 + text3);
		}

		private static string ExpandAmalgamationStats(string text, CharacterBody body, StatBank bank)
		{
			string[] array = text.Split('\n');
			for (int i = 0; i < array.Length; i++)
			{
				if (TryExpandLine(array[i], body, bank, out var expanded))
				{
					array[i] = expanded;
				}
			}
			return string.Join("\n", array);
		}

		private static bool TryExpandLine(string line, CharacterBody body, StatBank bank, out string expanded)
		{
			expanded = line;
			Match match = Regex.Match(line, "^(?<lead>\\s*(?:<[^>]+>)*)(?<name>[^:<\\r]+):\\s*(?<value>.*)$");
			if (!match.Success || !TryGetBonus(match.Groups["name"].Value.Trim(), body, bank, out var total, out var bonus, out var percent))
			{
				return false;
			}
			if (Mathf.Abs(bonus) < 0.0001f)
			{
				return false;
			}
			string text = (percent ? "%" : "");
			string text2 = FormatAmount(total) + text;
			Match match2 = Regex.Match(match.Groups["value"].Value, "style=(\\w+)");
			if (match2.Success)
			{
				text2 = "<style=" + match2.Groups[1].Value + ">" + text2 + "</style>";
			}
			expanded = match.Groups["lead"].Value + match.Groups["name"].Value.Trim() + ": " + text2;
			Match match3 = Regex.Match(line, "(</[^>]+>\\s*)+$");
			if (match3.Success && expanded.IndexOf(match3.Value, StringComparison.Ordinal) < 0)
			{
				expanded += match3.Value;
			}
			return true;
		}

		private static bool TryGetBonus(string name, CharacterBody body, StatBank bank, out float total, out float bonus, out bool percent)
		{
			total = 0f;
			bonus = 0f;
			percent = false;
			switch (name)
			{
			case "Health":
				total = body.maxHealth;
				bonus = bank.Health;
				return true;
			case "Shield":
				total = body.maxShield;
				bonus = bank.Shield;
				return true;
			case "Damage":
				total = body.damage;
				bonus = bank.Damage;
				return true;
			case "Attack Speed":
				total = body.attackSpeed;
				bonus = bank.AttackSpeed;
				return true;
			case "Crit Chance":
				total = body.crit;
				bonus = bank.CritChance;
				percent = true;
				return true;
			case "Crit Damage":
				total = body.critMultiplier;
				bonus = bank.CritDamage;
				return true;
			case "Bleed Chance":
				total = body.bleedChance;
				bonus = bank.Bleed;
				percent = true;
				return true;
			case "Armor":
				total = body.armor;
				bonus = bank.Armor;
				return true;
			case "Regen":
				total = body.regen;
				bonus = bank.Regen;
				return true;
			case "Speed":
			case "Move Speed":
				total = body.moveSpeed;
				bonus = bank.MoveSpeed;
				return true;
			case "Jump Power":
				total = body.jumpPower;
				bonus = bank.JumpPower;
				return true;
			case "Jumps":
				total = body.maxJumpCount;
				bonus = bank.ExtraJumps;
				return true;
			case "Luck":
				total = (Object.op_Implicit((Object)(object)body.master) ? body.master.luck : 0f);
				bonus = bank.Luck;
				return true;
			case "Curse":
				total = body.cursePenalty;
				bonus = 0f - bank.CurseReduction;
				return true;
			default:
				return false;
			}
		}

		private static string AppendMissingBonuses(string text, CharacterBody body, StatBank bank, bool includeOnHit)
		{
			StringBuilder stringBuilder = new StringBuilder();
			AppendBodyBonus(stringBuilder, text, "Health", body.maxHealth, bank.Health, percent: false, "cIsHealing");
			AppendBodyBonus(stringBuilder, text, "Shield", body.maxShield, bank.Shield, percent: false, "cIsHealing");
			AppendBodyBonus(stringBuilder, text, "Damage", body.damage, bank.Damage, percent: false, "cIsDamage");
			AppendBodyBonus(stringBuilder, text, "Attack Speed", body.attackSpeed, bank.AttackSpeed, percent: false, "cIsDamage");
			AppendBodyBonus(stringBuilder, text, "Crit Chance", body.crit, bank.CritChance, percent: true, "cIsDamage");
			AppendBodyBonus(stringBuilder, text, "Crit Damage", body.critMultiplier, bank.CritDamage, percent: false, "cIsDamage");
			AppendBodyBonus(stringBuilder, text, "Armor", body.armor, bank.Armor, percent: false, "cIsHealing");
			AppendBodyBonus(stringBuilder, text, "Regen", body.regen, bank.Regen, percent: false, "cIsHealing");
			if (!HasStatLine(text, "Speed") && !HasStatLine(text, "Move Speed"))
			{
				AppendBodyBonus(stringBuilder, text, "Move Speed", body.moveSpeed, bank.MoveSpeed, percent: false, "cIsUtility");
			}
			AppendBodyBonus(stringBuilder, text, "Jump Power", body.jumpPower, bank.JumpPower, percent: false, "cIsUtility");
			AppendBodyBonus(stringBuilder, text, "Jumps", body.maxJumpCount, bank.ExtraJumps, percent: false, "cIsUtility");
			float total = (Object.op_Implicit((Object)(object)body.master) ? body.master.luck : 0f);
			AppendBodyBonus(stringBuilder, text, "Luck", total, bank.Luck, percent: false, "cIsUtility");
			AppendProcBonus(stringBuilder, text, "Cooldown Reduction", bank.Cooldown * 100f, "cIsUtility");
			AppendBodyBonus(stringBuilder, text, "Curse", body.cursePenalty, 0f - bank.CurseReduction, percent: false, null);
			AppendProcBonus(stringBuilder, text, "Sprint Speed", bank.SprintSpeed * 100f, "cIsUtility");
			if (bank.FlatReduction > 0.0001f && !HasStatLine(text, "Damage Reduction"))
			{
				AppendStyledLine(stringBuilder, "Damage Reduction", FormatAmount(bank.FlatReduction), "cIsHealing");
			}
			if (includeOnHit)
			{
				StringBuilder stringBuilder2 = new StringBuilder();
				AppendBodyBonus(stringBuilder2, "", "Bleed Chance", body.bleedChance, bank.Bleed, percent: true, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Collapse", bank.Collapse, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "ATG", bank.Atg, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Plasma Shrimp", bank.PlasmaShrimp, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Ukulele", bank.Ukulele, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Polylute", bank.Polylute, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Sticky Bomb", bank.StickyBomb, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Charged Perforator", bank.ChargedPerforator, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Meat Hook", bank.MeatHook, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Chronobauble", bank.Chronobauble, "cIsUtility");
				AppendProcBonus(stringBuilder2, "", "Tentabauble", bank.Tentabauble, "cIsUtility");
				AppendProcBonus(stringBuilder2, "", "Leech", bank.LeechingSeed, "cIsHealing");
				if (bank.CritHeal > 0.0001f)
				{
					AppendStyledLine(stringBuilder2, "Heal on Crit", FormatAmount(bank.CritHeal), "cIsHealing");
				}
				AppendProcBonus(stringBuilder2, "", "Explosion", bank.Explosion, "cIsDamage");
				AppendProcBonus(stringBuilder2, "", "Stun", bank.Stun, "cIsUtility");
				if (stringBuilder2.Length > 0)
				{
					string value = stringBuilder2.ToString().TrimStart('\r', '\n');
					stringBuilder.Append("\n\n").Append(OnHitHeader(text));
					stringBuilder.Append("\n<indent=0.6em>").Append(value).Append("</indent>");
				}
			}
			return (stringBuilder.Length == 0) ? text : InsertInMargin(text, stringBuilder.ToString());
		}

		private static void ApplyLuck(CharacterMaster master, float bonus)
		{
			if (Object.op_Implicit((Object)(object)master) && bonus != 0f)
			{
				master.luck += bonus;
			}
		}

		private static string OnHitHeader(string text)
		{
			Match match = Regex.Match(text ?? string.Empty, "<size=([^>]+)>\\s*Stats\\s*</size>", RegexOptions.IgnoreCase);
			return match.Success ? ("<size=" + match.Groups[1].Value + ">On-Hit</size>") : "<size=115%>On-Hit</size>";
		}

		private static string InsertInMargin(string text, string extra)
		{
			int num = text.LastIndexOf("</margin>", StringComparison.OrdinalIgnoreCase);
			if (num < 0)
			{
				return text + extra;
			}
			if (extra.Length > 0 && extra[0] == '\n' && num > 0 && (text[num - 1] == '\n' || text[num - 1] == '\r'))
			{
				extra = extra.Substring(1);
			}
			return text.Insert(num, extra);
		}

		private static void AppendBodyBonus(StringBuilder extra, string text, string name, float total, float bonus, bool percent, string style)
		{
			if (!(Mathf.Abs(bonus) < 0.0001f) && !HasStatLine(text, name))
			{
				string text2 = (percent ? "%" : "");
				AppendStyledLine(extra, name, FormatAmount(total) + text2, style);
			}
		}

		private static void AppendProcBonus(StringBuilder extra, string text, string name, float chance, string style)
		{
			if (!(chance < 0.0001f) && !HasStatLine(text, name))
			{
				AppendStyledLine(extra, name, FormatAmount(chance) + "%", style);
			}
		}

		private static void AppendStyledLine(StringBuilder extra, string name, string value, string style)
		{
			if (!string.IsNullOrEmpty(style))
			{
				value = "<style=" + style + ">" + value + "</style>";
			}
			extra.Append('\n').Append(name).Append(": ")
				.Append(value);
		}

		private static bool HasStatLine(string text, string name)
		{
			return !string.IsNullOrEmpty(text) && Regex.IsMatch(text, "(?im)^.*" + Regex.Escape(name) + "\\s*:");
		}

		private static bool IsLookingGlassScoreboardOpen()
		{
			object obj = (_lookingGlassType?.GetField("scoreBoardOpen", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))?.GetValue(null);
			bool flag = default(bool);
			int num;
			if (obj is bool)
			{
				flag = (bool)obj;
				num = 1;
			}
			else
			{
				num = 0;
			}
			return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
		}

		private static CharacterBody GetLookingGlassBody()
		{
			object? obj = (_lookingGlassType?.GetField("cachedUserBody", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))?.GetValue(null);
			return (CharacterBody)((obj is CharacterBody) ? obj : null);
		}

		private static string FormatAmount(float value)
		{
			return value.ToString("0.##");
		}

		private static float GetEnemyWeight(CharacterBody victim)
		{
			float num = ConfigOr(_normalWeight, 1f);
			if (victim.isElite)
			{
				num = ConfigOr(_eliteWeight, 3f);
			}
			if (victim.isChampion)
			{
				num = Mathf.Max(num, ConfigOr(_championWeight, 5f));
			}
			if (victim.isBoss)
			{
				num = Mathf.Max(num, ConfigOr(_bossWeight, 8f));
			}
			if (victim.isBoss && victim.isElite)
			{
				num = ConfigOr(_eliteBossWeight, 10f);
			}
			return num;
		}

		internal static bool TryGetPlayerBank(CharacterBody body, out StatBank bank)
		{
			bank = null;
			if (!Active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || !Object.op_Implicit((Object)(object)body.master.playerCharacterMasterController))
			{
				return false;
			}
			return Banks.TryGetValue(((Object)body.master).GetInstanceID(), out bank);
		}

		private static void ApplySprintMultiplier(CharacterBody self)
		{
			if (Active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.master) && Object.op_Implicit((Object)(object)self.master.playerCharacterMasterController) && Banks.TryGetValue(((Object)self.master).GetInstanceID(), out var value) && !(value.SprintSpeed <= 0f))
			{
				int instanceID = ((Object)self).GetInstanceID();
				if (!BaseSprint.TryGetValue(instanceID, out var value2))
				{
					value2 = self.sprintingSpeedMultiplier;
					BaseSprint[instanceID] = value2;
				}
				self.sprintingSpeedMultiplier = value2 + value.SprintSpeed;
			}
		}

		private static void OnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			if (damageInfo != null && damageInfo.damage > 1f && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body))
			{
				float num = 0f;
				float reduction;
				if (TryGetPlayerBank(self.body, out var bank))
				{
					num = bank.FlatReduction;
				}
				else if (RecuperationArtifact.TryGetFlatReduction(self.body, out reduction))
				{
					num = reduction;
				}
				if (num > 0f)
				{
					damageInfo.damage = Mathf.Max(1f, damageInfo.damage - num);
				}
			}
			orig.Invoke(self, damageInfo);
		}

		private static void OnRecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			ApplySprintMultiplier(self);
			orig.Invoke(self);
			if (Active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.master) && Object.op_Implicit((Object)(object)self.master.playerCharacterMasterController) && Banks.TryGetValue(((Object)self.master).GetInstanceID(), out var value))
			{
				self.maxHealth += value.Health;
				self.maxShield += value.Shield;
				self.damage += value.Damage;
				self.moveSpeed += value.MoveSpeed;
				self.attackSpeed += value.AttackSpeed;
				self.crit += value.CritChance;
				self.critMultiplier += value.CritDamage;
				self.armor += value.Armor;
				self.regen += value.Regen;
				self.bleedChance += value.Bleed;
				self.jumpPower += value.JumpPower;
				if (value.ExtraJumps > 0)
				{
					SetMaxJumpCount(self, self.maxJumpCount + value.ExtraJumps);
				}
				if (value.CurseReduction > 0f && self.cursePenalty > 1f)
				{
					self.cursePenalty = Mathf.Max(1f, self.cursePenalty - value.CurseReduction);
				}
				ApplyLuck(self.master, value.Luck);
				if (value.Cooldown > 0f && Object.op_Implicit((Object)(object)self.skillLocator))
				{
					float scale = Mathf.Max(0.25f, 1f - value.Cooldown);
					ApplyCooldownScale(self.skillLocator.primary, scale);
					ApplyCooldownScale(self.skillLocator.secondary, scale);
					ApplyCooldownScale(self.skillLocator.utility, scale);
					ApplyCooldownScale(self.skillLocator.special, scale);
				}
				if (Object.op_Implicit((Object)(object)self.healthComponent) && self.healthComponent.health > self.maxHealth)
				{
					self.healthComponent.Networkhealth = self.maxHealth;
				}
			}
		}

		private static void ApplyCooldownScale(GenericSkill skill, float scale)
		{
			if (!((Object)(object)skill == (Object)null))
			{
				skill.cooldownScale *= scale;
			}
		}

		private static StatBank GetOrCreateBank(CharacterMaster master)
		{
			int instanceID = ((Object)master).GetInstanceID();
			if (!Banks.TryGetValue(instanceID, out var value))
			{
				value = new StatBank();
				Banks[instanceID] = value;
			}
			return value;
		}

		private static void RegisterBankHandlers()
		{
			//IL_0025: 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_0030: 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
			if (_bankHandlersRegistered)
			{
				return;
			}
			object obj = <>O.<11>__OnBankMessage;
			if (obj == null)
			{
				NetworkMessageDelegate val = OnBankMessage;
				<>O.<11>__OnBankMessage = val;
				obj = (object)val;
			}
			NetworkServer.RegisterHandler((short)24158, (NetworkMessageDelegate)obj);
			if (NetworkClient.allClients != null)
			{
				foreach (NetworkClient allClient in NetworkClient.allClients)
				{
					object obj2 = <>O.<11>__OnBankMessage;
					if (obj2 == null)
					{
						NetworkMessageDelegate val2 = OnBankMessage;
						<>O.<11>__OnBankMessage = val2;
						obj2 = (object)val2;
					}
					allClient.RegisterHandler((short)24158, (NetworkMessageDelegate)obj2);
				}
			}
			_bankHandlersRegistered = true;
		}

		private static void OnStartClient(orig_OnStartClient orig, NetworkManagerSystem self, NetworkClient client)
		{
			//IL_0025: 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_0030: Expected O, but got Unknown
			orig.Invoke(self, client);
			if (client != null)
			{
				object obj = <>O.<11>__OnBankMessage;
				if (obj == null)
				{
					NetworkMessageDelegate val = OnBankMessage;
					<>O.<11>__OnBankMessage = val;
					obj = (object)val;
				}
				client.RegisterHandler((short)24158, (NetworkMessageDelegate)obj);
			}
		}

		private static void OnUserAdded(orig_OnUserAdded orig, Run self, NetworkUser user)
		{
			orig.Invoke(self, user);
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)user) || ((NetworkBehaviour)user).connectionToClient == null)
			{
				return;
			}
			foreach (KeyValuePair<int, StatBank> bank in Banks)
			{
				CharacterMaster val = FindMaster(bank.Key);
				if (Object.op_Implicit((Object)(object)val))
				{
					SendBank(val, ((NetworkBehaviour)user).connectionToClient.connectionId);
				}
			}
		}

		private static CharacterMaster FindMaster(int instanceId)
		{
			ReadOnlyCollection<CharacterMaster> readOnlyInstancesList = CharacterMaster.readOnlyInstancesList;
			for (int i = 0; i < readOnlyInstancesList.Count; i++)
			{
				CharacterMaster val = readOnlyInstancesList[i];
				if (Object.op_Implicit((Object)(object)val) && ((Object)val).GetInstanceID() == instanceId)
				{
					return val;
				}
			}
			return null;
		}

		private static void SendBank(CharacterMaster master, int? connectionId)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)master))
			{
				return;
			}
			NetworkInstanceId netId = ((NetworkBehaviour)master).netId;
			if (!((NetworkInstanceId)(ref netId)).IsEmpty() && Banks.TryGetValue(((Object)master).GetInstanceID(), out var value))
			{
				BankMessage bankMessage = new BankMessage
				{
					MasterId = ((NetworkBehaviour)master).netId
				};
				bankMessage.Load(value);
				if (connectionId.HasValue)
				{
					NetworkServer.SendToClient(connectionId.Value, (short)24158, (MessageBase)(object)bankMessage);
				}
				else
				{
					NetworkServer.SendToAll((short)24158, (MessageBase)(object)bankMessage);
				}
			}
		}

		private static void OnBankMessage(NetworkMessage message)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (message == null || NetworkServer.active)
			{
				return;
			}
			BankMessage bankMessage = message.ReadMessage<BankMessage>();
			if (!((NetworkInstanceId)(ref bankMessage.MasterId)).IsEmpty())
			{
				StatBank statBank = new StatBank();
				statBank.CopyFrom(bankMessage.Bank);
				if (!TryStoreBank(bankMessage.MasterId, statBank))
				{
					PendingBanks[bankMessage.MasterId] = statBank;
				}
			}
		}

		private static void ApplyPendingBanks()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (PendingBanks.Count == 0 || NetworkServer.active)
			{
				return;
			}
			List<NetworkInstanceId> list = new List<NetworkInstanceId>();
			foreach (KeyValuePair<NetworkInstanceId, StatBank> pendingBank in PendingBanks)
			{
				if (TryStoreBank(pendingBank.Key, pendingBank.Value))
				{
					list.Add(pendingBank.Key);
				}
			}
			for (int i = 0; i < list.Count; i++)
			{
				PendingBanks.Remove(list[i]);
			}
		}

		private static bool TryStoreBank(NetworkInstanceId netId, StatBank bank)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = ClientScene.FindLocalObject(netId);
			CharacterMaster val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterMaster>() : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return false;
			}
			Banks[((Object)val2).GetInstanceID()] = bank;
			CharacterBody body = val2.GetBody();
			if (Object.op_Implicit((Object)(object)body))
			{
				body.RecalculateStats();
			}
			return true;
		}

		private static CharacterBody ResolveBeneficiary(DamageReport report)
		{
			if (IsPlayerBody(report.attackerBody))
			{
				return report.attackerBody;
			}
			if (Object.op_Implicit((Object)(object)report.attackerOwnerMaster) && Object.op_Implicit((Object)(object)report.attackerOwnerMaster.playerCharacterMasterController))
			{
				return report.attackerOwnerMaster.GetBody();
			}
			CharacterBody attackerBody = report.attackerBody;
			object obj;
			if (attackerBody == null)
			{
				obj = null;
			}
			else
			{
				CharacterMaster master = attackerBody.master;
				if (master == null)
				{
					obj = null;
				}
				else
				{
					MinionOwnership minionOwnership = master.minionOwnership;
					obj = ((minionOwnership != null) ? minionOwnership.ownerMaster : null);
				}
			}
			CharacterMaster val = (CharacterMaster)obj;
			if (val != null && Object.op_Implicit((Object)(object)val.playerCharacterMasterController))
			{
				return val.GetBody();
			}
			return null;
		}

		private static bool IsPlayerBody(CharacterBody body)
		{
			return Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)body.master.playerCharacterMasterController);
		}

		private static bool IsEnemy(CharacterBody body)
		{
			//IL_0031: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)body) || body.isPlayerControlled || !Object.op_Implicit((Object)(object)body.teamComponent))
			{
				return false;
			}
			TeamIndex teamIndex = body.teamComponent.teamIndex;
			return (int)teamIndex == 2 || (int)teamIndex == 3 || (int)teamIndex == 4;
		}
	}
	internal static class AmalgamationOnHit
	{
		internal struct OnHitProfile
		{
			public float Collapse;

			public float Atg;

			public float PlasmaShrimp;

			public float Ukulele;

			public float Polylute;

			public float StickyBomb;

			public float ChargedPerforator;

			public float MeatHook;

			public float Chronobauble;

			public float Tentabauble;

			public float LeechingSeed;

			public float Bleed;

			public float CritHeal;

			public float Explosion;

			public float Stun;
		}

		internal static void OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			orig.Invoke(self, damageInfo, victim);
			if (NetworkServer.active && damageInfo != null && Object.op_Implicit((Object)(object)victim) && !damageInfo.rejected && !(damageInfo.procCoefficient <= 0f))
			{
				CharacterBody val = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent<CharacterBody>() : null);
				if (Object.op_Implicit((Object)(object)val) && TryGetProfile(val, out var profile))
				{
					CharacterBody component = victim.GetComponent<CharacterBody>();
					CharacterMaster master = val.master;
					float procCoefficient = damageInfo.procCoefficient;
					TryCollapse(profile, damageInfo, val, victim, master, procCoefficient);
					TryAtg(profile, damageInfo, val, victim, master, procCoefficient);
					TryPlasmaShrimp(profile, damageInfo, val, component, master, procCoefficient);
					TryUkulele(profile, damageInfo, val, victim, master, procCoefficient);
					TryPolylute(profile, damageInfo, val, component, master, procCoefficient);
					TryStickyBomb(profile, damageInfo, val, component, master, procCoefficient);
					TryChargedPerforator(profile, damageInfo, val, component, master, procCoefficient);
					TryMeatHook(profile, damageInfo, val, victim, master, procCoefficient);
					TrySlow(profile, damageInfo, component, master, procCoefficient);
					TryNullify(profile, damageInfo, component, master, procCoefficient);
					TryLeech(profile, damageInfo, val, master, procCoefficient);
					TryExtraBleed(profile, damageInfo, victim, master, procCoefficient);
					TryHealOnCrit(profile, damageInfo, val);
					TryExplosion(profile, damageInfo, val);
					TryStun(profile, damageInfo, component, master, procCoefficient);
				}
			}
		}

		private static bool TryGetProfile(CharacterBody attacker, out OnHitProfile profile)
		{
			if (AmalgamationArtifact.TryGetPlayerBank(attacker, out var bank))
			{
				profile = new OnHitProfile
				{
					Collapse = bank.Collapse,
					Atg = bank.Atg,
					PlasmaShrimp = bank.PlasmaShrimp,
					Ukulele = bank.Ukulele,
					Polylute = bank.Polylute,
					StickyBomb = bank.StickyBomb,
					ChargedPerforator = bank.ChargedPerforator,
					MeatHook = bank.MeatHook,
					Chronobauble = bank.Chronobauble,
					Tentabauble = bank.Tentabauble,
					LeechingSeed = bank.LeechingSeed,
					Bleed = bank.Bleed,
					CritHeal = bank.CritHeal,
					Explosion = bank.Explosion,
					Stun = bank.Stun
				};
				return true;
			}
			return RecuperationArtifact.TryGetOnHits(attacker, out profile);
		}

		private static int Stacks(float chance, float proc, CharacterMaster master)
		{
			return OnHitOverflow.StackCount(chance, proc, master);
		}

		private static void TryCollapse(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, GameObject victim, CharacterMaster master, float proc)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			int num = Stacks(bank.Collapse, proc, master);
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)19) && num > 0)
			{
				ProcChainMask procChainMask = damageInfo.procChainMask;
				((ProcChainMask)(ref procChainMask)).AddProc((ProcType)19);
				DotDef dotDef = DotController.GetDotDef((DotIndex)8);
				for (int i = 0; i < num; i++)
				{
					DotController.InflictDot(victim, damageInfo.attacker, damageInfo.inflictedHurtbox, procChainMask, (DotIndex)8, dotDef.interval, 1f, (uint?)null);
				}
			}
		}

		private static void TryAtg(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, GameObject victim, CharacterMaster master, float proc)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			int num = Stacks(bank.Atg, proc, master);
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)1) && num > 0)
			{
				float num2 = Util.OnHitProcDamage(damageInfo.damage, attacker.damage, 3f * (float)num);
				MissileUtils.FireMissile(attacker.corePosition, attacker, damageInfo.procChainMask, victim, num2, damageInfo.crit, CommonAssets.missilePrefab, (DamageColorIndex)3, true);
			}
		}

		private static void TryPlasmaShrimp(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, CharacterBody victimBody, CharacterMaster master, float proc)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			int num = Stacks(bank.PlasmaShrimp, proc, master);
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)1) && Object.op_Implicit((Object)(object)attacker.healthComponent) && !(attacker.healthComponent.shield <= 0f) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.mainHurtBox) && num > 0)
			{
				MissileVoidOrb val = new MissileVoidOrb
				{
					origin = attacker.corePosition,
					damageValue = Util.OnHitProcDamage(damageInfo.damage, attacker.damage, 0.4f * (float)num),
					isCrit = damageInfo.crit,
					teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)attacker.teamComponent)) ? 1 : ((int)attacker.teamComponent.teamIndex)),
					attacker = damageInfo.attacker,
					procChainMask = damageInfo.procChainMask,
					procCoefficient = 0.2f,
					damageColorIndex = (DamageColorIndex)9,
					target = victimBody.mainHurtBox
				};
				((ProcChainMask)(ref ((GenericDamageOrb)val).procChainMask)).AddProc((ProcType)1);
				OrbManager.instance.AddOrb((Orb)(object)val);
			}
		}

		private static void TryUkulele(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, GameObject victim, CharacterMaster master, float proc)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			int num = Stacks(bank.Ukulele, proc, master);
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)3) && num > 0)
			{
				HealthComponent component = victim.GetComponent<HealthComponent>();
				LightningOrb val = new LightningOrb
				{
					origin = damageInfo.position,
					damageValue = Util.OnHitProcDamage(damageInfo.damage, attacker.damage, 0.8f * (float)num),
					isCrit = damageInfo.crit,
					bouncesRemaining = 2,
					teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)attacker.teamComponent)) ? 1 : ((int)attacker.teamComponent.teamIndex)),
					attacker = damageInfo.attacker,
					bouncedObjects = new List<HealthComponent> { component },
					procChainMask = damageInfo.procChainMask,
					procCoefficient = 0.2f,
					lightningType = (LightningType)0,
					damageColorIndex = (DamageColorIndex)3,
					range = 20f
				};
				((ProcChainMask)(ref val.procChainMask)).AddProc((ProcType)3);
				val.damageType.damageTypeExtended = (DamageTypeExtended)8192;
				HurtBox val2 = val.PickNextTarget(damageInfo.position);
				if (Object.op_Implicit((Object)(object)val2))
				{
					((Orb)val).target = val2;
					OrbManager.instance.AddOrb((Orb)(object)val);
				}
			}
		}

		private static void TryPolylute(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, CharacterBody victimBody, CharacterMaster master, float proc)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			int num = Stacks(bank.Polylute, proc, master);
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)3) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.mainHurtBox) && num > 0)
			{
				VoidLightningOrb val = new VoidLightningOrb
				{
					origin = damageInfo.position,
					damageValue = Util.OnHitProcDamage(damageInfo.damage, attacker.damage, 0.6f * (float)num),
					isCrit = damageInfo.crit,
					totalStrikes = 3,
					teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)attacker.teamComponent)) ? 1 : ((int)attacker.teamComponent.teamIndex)),
					attacker = damageInfo.attacker,
					procChainMask = damageInfo.procChainMask,
					procCoefficient = 0.2f,
					damageColorIndex = (DamageColorIndex)9,
					secondsPerStrike = 0.1f,
					target = victimBody.mainHurtBox
				};
				((ProcChainMask)(ref val.procChainMask)).AddProc((ProcType)3);
				val.damageType.damageTypeExtended = (DamageTypeExtended)8192;
				OrbManager.instance.AddOrb((Orb)(object)val);
			}
		}

		private static void TryStickyBomb(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, CharacterBody victimBody, CharacterMaster master, float proc)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			int num = Stacks(bank.StickyBomb, proc, master);
			if (Object.op_Implicit((Object)(object)victimBody) && num > 0)
			{
				Vector3 position = damageInfo.position;
				Vector3 val = victimBody.corePosition - position;
				float magnitude = ((Vector3)(ref val)).magnitude;
				Quaternion rotation = ((magnitude != 0f) ? Util.QuaternionSafeLookRotation(val) : Random.rotationUniform);
				ProjectileManager instance = ProjectileManager.instance;
				FireProjectileInfo val2 = new FireProjectileInfo
				{
					projectilePrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/StickyBomb"),
					position = position,
					rotation = rotation,
					owner = damageInfo.attacker,
					damage = Util.OnHitProcDamage(damageInfo.damage, attacker.damage, 1.8f * (float)num),
					crit = damageInfo.crit,
					procChainMask = damageInfo.procChainMask,
					force = 100f,
					damageColorIndex = (DamageColorIndex)3
				};
				((FireProjectileInfo)(ref val2)).speedOverride = ((Object.op_Implicit((Object)(object)victimBody.healthComponent) && victimBody.healthComponent.alive) ? (magnitude * 5f) : (-1f));
				instance.FireProjectile(val2);
			}
		}

		private static void TryChargedPerforator(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, CharacterBody victimBody, CharacterMaster master, float proc)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			int num = Stacks(bank.ChargedPerforator, proc, master);
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)18) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.mainHurtBox) && num > 0)
			{
				ProcChainMask procChainMask = damageInfo.procChainMask;
				((ProcChainMask)(ref procChainMask)).AddProc((ProcType)18);
				OrbManager.instance.AddOrb((Orb)new SimpleLightningStrikeOrb
				{
					attacker = ((Component)attacker).gameObject,
					damageColorIndex = (DamageColorIndex)3,
					damageValue = Util.OnHitProcDamage(damageInfo.damage, attacker.damage, 5f * (float)num),
					isCrit = Util.CheckRoll(attacker.crit, master),
					procChainMask = procChainMask,
					procCoefficient = 1f,
					target = victimBody.mainHurtBox
				});
			}
		}

		private static void TryMeatHook(OnHitProfile bank, DamageInfo damageInfo, CharacterBody attacker, GameObject victim, CharacterMaster master, float proc)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to in