Decompiled source of RiskOfTactics v0.1.1

plugins/RiskOfTactics.dll

Decompiled 39 minutes ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using LookingGlass.ItemStatsNameSpace;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI.LogBook;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfTactics.Content.Buffs;
using RiskOfTactics.Content.Items.Artifacts;
using RiskOfTactics.Content.Items.Completes;
using RiskOfTactics.Extensions;
using RiskOfTactics.Managers;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.UI.LogBook;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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("RiskOfTactics")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+499ec8d232d226ac7b18dd9f34f9b0318b107547")]
[assembly: AssemblyProduct("RiskOfTactics")]
[assembly: AssemblyTitle("RiskOfTactics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RiskOfTactics
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("shirograhm.RiskOfTactics", "RiskOfTactics", "0.1.1")]
	public class RiskOfTactics : BaseUnityPlugin
	{
		public const string PluginGUID = "shirograhm.RiskOfTactics";

		public const string PluginAuthor = "shirograhm";

		public const string PluginName = "RiskOfTactics";

		public const string PluginVersion = "0.1.1";

		public static Random RandGen = new Random();

		public static Xoroshiro128Plus rng = new Xoroshiro128Plus((ulong)RandGen.Next());

		public static ExpansionDef sotvDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();

		public static ExpansionDef sotsDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion();

		public static ExpansionDef acDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC3/Common/DLC3.asset").WaitForCompletion();

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			PInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			AssetManager.Init();
			GameEventManager.Init();
			ConfigOptions.Init();
			Utilities.Init();
			((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)Integrations.Init);
			Sunder.Init();
			if (AdaptiveHelm.isEnabled.Value)
			{
				AdaptiveHelm.Init();
			}
			if (ArchangelsStaff.isEnabled.Value)
			{
				ArchangelsStaff.Init();
			}
			if (Bloodthirster.isEnabled.Value)
			{
				Bloodthirster.Init();
			}
			if (BrambleVest.isEnabled.Value)
			{
				BrambleVest.Init();
			}
			if (Crownguard.isEnabled.Value)
			{
				Crownguard.Init();
			}
			if (DragonsClaw.isEnabled.Value)
			{
				DragonsClaw.Init();
			}
			if (GuinsoosRageblade.isEnabled.Value)
			{
				GuinsoosRageblade.Init();
			}
			if (HandOfJustice.isEnabled.Value)
			{
				HandOfJustice.Init();
			}
			if (Quicksilver.isEnabled.Value)
			{
				Quicksilver.Init();
			}
			if (StrikersFlail.isEnabled.Value)
			{
				StrikersFlail.Init();
			}
			if (SpearOfShojin.isEnabled.Value)
			{
				SpearOfShojin.Init();
			}
			if (SunfireCape.isEnabled.Value)
			{
				SunfireCape.Init();
			}
			if (GamblersBlade.isEnabled.Value)
			{
				GamblersBlade.Init();
			}
			if (HellfireHatchet.isEnabled.Value)
			{
				HellfireHatchet.Init();
			}
			if (HorizonFocus.isEnabled.Value)
			{
				HorizonFocus.Init();
			}
			if (StatikkShiv.isEnabled.Value)
			{
				StatikkShiv.Init();
			}
			Log.Message("Finished initializations.");
		}
	}
	public static class Utilities
	{
		private class SyncForceRecalculate : INetMessage, ISerializableObject
		{
			private NetworkInstanceId netID;

			public SyncForceRecalculate()
			{
			}

			public SyncForceRecalculate(NetworkInstanceId ID)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				netID = ID;
			}

			public 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)
				netID = reader.ReadNetworkId();
			}

			public void OnReceived()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					return;
				}
				GameObject val = Util.FindNetworkObject(netID);
				if (Object.op_Implicit((Object)(object)val))
				{
					CharacterBody component = val.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.RecalculateStats();
					}
				}
			}

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

		internal static void Init()
		{
			NetworkingAPI.RegisterMessageType<SyncForceRecalculate>();
		}

		public static void ForceRecalculate(CharacterBody body)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			body.RecalculateStats();
			if (NetworkServer.active)
			{
				new SyncForceRecalculate(((NetworkBehaviour)body).netId);
			}
		}

		public static void AddRecalculateOnFrameHook(ItemDef def)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			CharacterBody.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory))
				{
					int itemCountEffective = self.inventory.GetItemCountEffective(def);
					if (itemCountEffective > 0)
					{
						ForceRecalculate(self);
					}
				}
			};
		}

		public static CharacterBody GetMinionOwnershipParentBody(CharacterBody body)
		{
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)body.master.minionOwnership) && Object.op_Implicit((Object)(object)body.master.minionOwnership.ownerMaster) && Object.op_Implicit((Object)(object)body.master.minionOwnership.ownerMaster.GetBody()))
			{
				return body.master.minionOwnership.ownerMaster.GetBody();
			}
			return body;
		}

		public static uint ScaleGoldWithDifficulty(int goldGranted)
		{
			return Convert.ToUInt32((float)goldGranted * (1f + 50f * GetDifficultyAsPercentage()));
		}

		public static float GetChanceAfterLuck(float percent, float luckIn)
		{
			int num = Mathf.CeilToInt(luckIn);
			if (num > 0)
			{
				return 1f - Mathf.Pow(1f - percent, (float)(num + 1));
			}
			if (num < 0)
			{
				return Mathf.Pow(percent, (float)(Mathf.Abs(num) + 1));
			}
			return percent;
		}

		public static bool IsMeleeBodyPrefab(GameObject bodyPrefab)
		{
			if (!Object.op_Implicit((Object)(object)bodyPrefab))
			{
				return false;
			}
			string text = ((Object)bodyPrefab).name;
			if (text.Contains("(Clone)"))
			{
				text = text.Replace("(Clone)", "");
			}
			string[] source = ConfigManager.Scaling.meleeCharactersList.Value.Split(',');
			return source.Contains(text);
		}

		public static bool IsRangedBodyPrefab(GameObject bodyPrefab)
		{
			if (!Object.op_Implicit((Object)(object)bodyPrefab))
			{
				return false;
			}
			string text = ((Object)bodyPrefab).name;
			if (text.Contains("(Clone)"))
			{
				text = text.Replace("(Clone)", "");
			}
			string[] source = ConfigManager.Scaling.rangedCharactersList.Value.Split(',');
			return source.Contains(text);
		}

		public static float GetMissingHealth(HealthComponent healthComponent, bool includeShield)
		{
			if (includeShield)
			{
				return healthComponent.fullCombinedHealth * (1f - healthComponent.combinedHealthFraction);
			}
			return healthComponent.fullHealth * (1f - healthComponent.healthFraction);
		}

		public static float GetMissingHealthPercent(HealthComponent healthComponent, bool includeShield)
		{
			if (includeShield)
			{
				return 100f * (1f - healthComponent.combinedHealthFraction);
			}
			return 100f * (1f - healthComponent.healthFraction);
		}

		public static float GetDifficultyAsPercentage()
		{
			return (Stage.instance.entryDifficultyCoefficient - 1f) / 98f;
		}

		public static float GetDifficultyAsMultiplier()
		{
			return Stage.instance.entryDifficultyCoefficient;
		}

		public static float GetLinearStacking(float baseValue, int count)
		{
			return GetLinearStacking(baseValue, baseValue, count);
		}

		public static float GetLinearStacking(float baseValue, float extraValue, int count)
		{
			return baseValue + extraValue * (float)(count - 1);
		}

		public static float GetExponentialStacking(float percent, int count)
		{
			return GetExponentialStacking(percent, percent, count);
		}

		public static float GetExponentialStacking(float percent, float stackPercent, int count)
		{
			return 1f - (1f - percent) * Mathf.Pow(1f - stackPercent, (float)(count - 1));
		}

		public static float GetReverseExponentialStacking(float baseValue, float reducePercent, int count)
		{
			return baseValue * Mathf.Pow(1f - reducePercent, (float)(count - 1));
		}

		public static float GetHyperbolicStacking(float percent, int count)
		{
			return GetHyperbolicStacking(percent, percent, count);
		}

		public static float GetHyperbolicStacking(float percent, float extraPercent, int count)
		{
			float num = (1f + percent) * (1f + extraPercent * (float)(count - 1));
			return 1f - 1f / num;
		}

		internal static BuffDef GenerateBuffDef(string name, Sprite sprite, bool canStack, bool isHidden, bool isDebuff, bool isCooldown)
		{
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = name;
			val.iconSprite = sprite;
			val.canStack = canStack;
			val.isHidden = isHidden;
			val.isDebuff = isDebuff;
			val.isCooldown = isCooldown;
			return val;
		}

		internal static bool OnSameTeam(CharacterBody body1, CharacterBody body2)
		{
			//IL_004d: 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)
			if ((Object)(object)body1 == (Object)null)
			{
				throw new ArgumentNullException("body1");
			}
			if ((Object)(object)body2 == (Object)null)
			{
				throw new ArgumentNullException("body2");
			}
			return Object.op_Implicit((Object)(object)body1.teamComponent) && Object.op_Implicit((Object)(object)body2.teamComponent) && body1.teamComponent.teamIndex == body2.teamComponent.teamIndex;
		}

		internal static bool IsValidTargetBody(CharacterBody body)
		{
			return Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent);
		}

		internal static void SpawnHealEffect(CharacterBody self)
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			EffectData val = new EffectData
			{
				origin = self.transform.position,
				rootObject = ((Component)self).gameObject
			};
			EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MedkitHealEffect"), val, true);
		}
	}
}
namespace RiskOfTactics.Managers
{
	public static class AssetManager
	{
		public static AssetBundle bundle;

		public const string bundleName = "rotassets";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(RiskOfTactics.PInfo.Location), "rotassets");

		public static void Init()
		{
			bundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	public static class ConfigManager
	{
		public static class Scaling
		{
			public static ConfigFile config = new ConfigFile(Paths.ConfigPath + "\\RiskOfTactics.cfg", true);

			public static string categoryName = "RiskOfTactics Config";

			public static string categoryGUID = "shirograhm.RiskOfTactics_config";

			public static ConfigOptions.ConfigurableValue<bool> useCustomValues = ConfigOptions.ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "! Important !", "Use Custom Configs", defaultValue: false, "Set to true to enable the custom config values below.");

			public static ConfigOptions.ConfigurableValue<string> meleeCharactersList = ConfigOptions.ConfigurableValue.CreateString(categoryGUID, categoryName, config, "! Important !", "Melee Characters", "MercBody,LoaderBody,CrocoBody,FalseSonBody", "List of melee characters. Add modded charater bodies here to enable selective item effects (e.g. Adaptive Helm).");

			public static ConfigOptions.ConfigurableValue<string> rangedCharactersList = ConfigOptions.ConfigurableValue.CreateString(categoryGUID, categoryName, config, "! Important !", "Ranged Characters", "CommandoBody,HuntressBody,Bandit2Body,ToolbotBody,EngiBody,EngiTurretBody,MageBody,TreebotBody,CaptainBody,RailGunnerBody,VoidSurvivorBody,SeekerBody,ChefBody,ScavBody", "List of ranged characters. Add modded charater bodies here to enable selective item effects (e.g. Adaptive Helm).");

			public static ConfigOptions.ConfigurableValue<float> radiantItemStatMultiplier = ConfigOptions.ConfigurableValue.CreateFloat(categoryGUID, categoryName, config, "! Important !", "Radiant Stat Multiplier", 2f, 0f, 1000000f, "Value all stats are multiplied by when upgraded to radiant.");
		}
	}
	public class ConfigurableValue<T> : ConfigOptions.ConfigurableValue<T>
	{
		public ConfigurableValue(string section, string key, float defaultValue, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, Action<float> onChanged = null)
			: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, isRadiantStat, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
		{
			ConfigOptions.ConfigurableValue.CreateFloat(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, 0f, 1000000f, description, stringsToAffect, isRadiantStat, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
		}

		public ConfigurableValue(string section, string key, int defaultValue, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, Action<int> onChanged = null)
			: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, isRadiantStat, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
		{
			ConfigOptions.ConfigurableValue.CreateInt(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, 0, 1000000, description, stringsToAffect, isRadiantStat, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
		}

		public ConfigurableValue(string section, string key, bool defaultValue, string description = "", List<string> stringsToAffect = null, Action<bool> onChanged = null)
			: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, isRadiantStat: false, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
		{
			ConfigOptions.ConfigurableValue.CreateBool(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, description, stringsToAffect, isRadiantStat: false, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
		}

		public ConfigurableValue(string section, string key, string defaultValue, string description = "", List<string> stringsToAffect = null, Action<string> onChanged = null)
			: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, isRadiantStat: false, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
		{
			ConfigOptions.ConfigurableValue.CreateString(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, description, stringsToAffect, isRadiantStat: false, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
		}
	}
	public static class ConfigOptions
	{
		public abstract class ConfigurableValue
		{
			public static List<ConfigurableValue> instancesList = new List<ConfigurableValue>();

			public List<string> stringsToAffect = new List<string>();

			public bool isRadiantStat = false;

			public string key = "";

			public string id = "";

			public static ConfigurableValue<T> Create<T>(ConfigFile configFile, string section, string key, T defaultValue, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<T> onChanged = null)
			{
				return new ConfigurableValue<T>(configFile, section, key, defaultValue, description, stringsToAffect, isRadiantStat, useCustomValueConfigEntry, restartRequired, onChanged);
			}

			public static ConfigurableValue<int> CreateInt(string modGUID, string modName, ConfigFile configFile, string section, string key, int defaultValue, int min = 0, int max = 1000, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<int> onChanged = null)
			{
				return Create(configFile, section, key, defaultValue, description, stringsToAffect, isRadiantStat, useCustomValueConfigEntry, restartRequired, onChanged);
			}

			public static ConfigurableValue<float> CreateFloat(string modGUID, string modName, ConfigFile configFile, string section, string key, float defaultValue, float min = 0f, float max = 1000f, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<float> onChanged = null)
			{
				return Create(configFile, section, key, defaultValue, description, stringsToAffect, isRadiantStat, useCustomValueConfigEntry, restartRequired, onChanged);
			}

			public static ConfigurableValue<bool> CreateBool(string modGUID, string modName, ConfigFile configFile, string section, string key, bool defaultValue, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<bool> onChanged = null)
			{
				return Create(configFile, section, key, defaultValue, description, stringsToAffect, isRadiantStat, useCustomValueConfigEntry, restartRequired, onChanged);
			}

			public static ConfigurableValue<string> CreateString(string modGUID, string modName, ConfigFile configFile, string section, string key, string defaultValue, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<string> onChanged = null)
			{
				return Create(configFile, section, key, defaultValue, description, stringsToAffect, isRadiantStat, useCustomValueConfigEntry, restartRequired, onChanged);
			}
		}

		public class ConfigurableValue<T> : ConfigurableValue
		{
			public ConfigEntry<T> bepinexConfigEntry;

			private ConfigEntry<bool> useCustomValueConfigEntry;

			private T defaultValue;

			public T Value
			{
				get
				{
					if (useCustomValueConfigEntry != null && useCustomValueConfigEntry.Value)
					{
						return bepinexConfigEntry.Value;
					}
					return defaultValue;
				}
			}

			public ConfigurableValue(ConfigFile configFile, string section, string key, T defaultValue, string description = "", List<string> stringsToAffect = null, bool isRadiantStat = false, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<T> onChanged = null)
			{
				ConfigurableValue<T> configurableValue = this;
				id = Path.GetFileNameWithoutExtension(configFile.ConfigFilePath) + "." + section + "." + key;
				ConfigurableValue configurableValue2 = ConfigurableValue.instancesList.FirstOrDefault((ConfigurableValue x) => x.id == configurableValue.id);
				if (configurableValue2 != null)
				{
					ConfigurableValue<T> configurableValue3 = configurableValue2 as ConfigurableValue<T>;
					bepinexConfigEntry = configurableValue3.bepinexConfigEntry;
					this.useCustomValueConfigEntry = useCustomValueConfigEntry;
				}
				else
				{
					bepinexConfigEntry = configFile.Bind<T>(section, key, defaultValue, description);
					ConfigurableValue.instancesList.Add(this);
				}
				this.useCustomValueConfigEntry = useCustomValueConfigEntry;
				base.key = key;
				this.defaultValue = defaultValue;
				base.isRadiantStat = isRadiantStat;
				if (stringsToAffect != null)
				{
					base.stringsToAffect = stringsToAffect;
				}
				else
				{
					base.stringsToAffect = new List<string>();
				}
				if (onChanged != null)
				{
					bepinexConfigEntry.SettingChanged += delegate
					{
						onChanged(configurableValue.bepinexConfigEntry.Value);
						reloadLogbook = true;
					};
					onChanged(bepinexConfigEntry.Value);
					reloadLogbook = true;
				}
			}

			public override string ToString()
			{
				return Convert.ToString(Value, CultureInfo.InvariantCulture);
			}

			public static implicit operator T(ConfigurableValue<T> configurableValue)
			{
				return configurableValue.Value;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__LogBookController_Awake;

			public static hook_GetLocalizedStringByToken <1>__Language_GetLocalizedStringByToken;
		}

		private static bool reloadLogbook;

		internal static void Init()
		{
			//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_001c: Expected O, but got Unknown
			//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
			object obj = <>O.<0>__LogBookController_Awake;
			if (obj == null)
			{
				hook_Awake val = LogBookController_Awake;
				<>O.<0>__LogBookController_Awake = val;
				obj = (object)val;
			}
			LogBookController.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__Language_GetLocalizedStringByToken;
			if (obj2 == null)
			{
				hook_GetLocalizedStringByToken val2 = Language_GetLocalizedStringByToken;
				<>O.<1>__Language_GetLocalizedStringByToken = val2;
				obj2 = (object)val2;
			}
			Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj2;
		}

		private static void LogBookController_Awake(orig_Awake orig, LogBookController self)
		{
			orig.Invoke(self);
			if (reloadLogbook)
			{
				reloadLogbook = false;
				LogBookController.BuildStaticData();
			}
		}

		private static string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token)
		{
			string text = orig.Invoke(self, token);
			bool flag = token.Contains("RADIANT_");
			foreach (ConfigurableValue item in ConfigurableValue.instancesList.FindAll((ConfigurableValue x) => x.stringsToAffect.Contains(token.Replace("RADIANT_", ""))))
			{
				string newValue;
				if (flag && item.isRadiantStat)
				{
					if (1 == 0)
					{
					}
					string text2 = ((item is ConfigurableValue<float> configurableValue) ? (configurableValue.Value * (float)ConfigManager.Scaling.radiantItemStatMultiplier).ToString() : ((!(item is ConfigurableValue<int> configurableValue2)) ? item.ToString() : ((float)configurableValue2.Value * (float)ConfigManager.Scaling.radiantItemStatMultiplier).ToString()));
					if (1 == 0)
					{
					}
					newValue = text2;
				}
				else
				{
					newValue = item.ToString();
				}
				text = text.Replace("{" + item.key + "}", newValue);
				text = text.Replace("{Sunder Reduction}", Sunder.armorReduction.Value.ToString());
			}
			return text;
		}
	}
	internal class GameEventManager
	{
		public delegate void DamageAttackerVictimEventHandler(DamageInfo damageInfo, GenericCharacterInfo attackerInfo, GenericCharacterInfo victimInfo);

		public delegate void DamageReportEventHandler(DamageReport damageReport);

		public struct GenericCharacterInfo
		{
			public GameObject gameObject;

			public CharacterBody body;

			public CharacterMaster master;

			public TeamComponent teamComponent;

			public HealthComponent healthComponent;

			public Inventory inventory;

			public TeamIndex teamIndex;

			public Vector3 aimOrigin;

			public unsafe GenericCharacterInfo(CharacterBody body)
			{
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: 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_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1->IL00a1: Incompatible stack types: Ref vs I4
				//IL_0096->IL00a1: Incompatible stack types: I4 vs Ref
				//IL_0096->IL00a1: Incompatible stack types: Ref vs I4
				this.body = body;
				gameObject = (Object.op_Implicit((Object)(object)body) ? ((Component)body).gameObject : null);
				master = (Object.op_Implicit((Object)(object)body) ? body.master : null);
				teamComponent = (Object.op_Implicit((Object)(object)body) ? body.teamComponent : null);
				healthComponent = (Object.op_Implicit((Object)(object)body) ? body.healthComponent : null);
				inventory = (Object.op_Implicit((Object)(object)master) ? master.inventory : null);
				ref GenericCharacterInfo reference = ref this;
				int num;
				if (Object.op_Implicit((Object)(object)teamComponent))
				{
					reference = ref *(GenericCharacterInfo*)teamComponent.teamIndex;
					num = (int)(ref reference);
				}
				else
				{
					num = 0;
					reference = ref *(GenericCharacterInfo*)num;
					num = (int)(ref reference);
				}
				Unsafe.Write(&((GenericCharacterInfo*)num)->teamIndex, (TeamIndex)(ref reference));
				Vector3 normalized;
				if (!Object.op_Implicit((Object)(object)body))
				{
					Vector3 insideUnitSphere = Random.insideUnitSphere;
					normalized = ((Vector3)(ref insideUnitSphere)).normalized;
				}
				else
				{
					normalized = body.aimOrigin;
				}
				aimOrigin = normalized;
			}
		}

		public class GenericDamageEvent : MonoBehaviour, IOnIncomingDamageServerReceiver, IOnTakeDamageServerReceiver
		{
			public HealthComponent healthComponent;

			public CharacterBody victimBody;

			public void Start()
			{
				healthComponent = ((Component)this).GetComponent<HealthComponent>();
				if (!Object.op_Implicit((Object)(object)healthComponent))
				{
					Object.Destroy((Object)(object)this);
				}
				else
				{
					victimBody = healthComponent.body;
				}
			}

			public void OnIncomingDamageServer(DamageInfo damageInfo)
			{
				GenericCharacterInfo attackerInfo = default(GenericCharacterInfo);
				if (Object.op_Implicit((Object)(object)damageInfo.attacker))
				{
					attackerInfo = new GenericCharacterInfo(damageInfo.attacker.GetComponent<CharacterBody>());
				}
				GenericCharacterInfo victimInfo = new GenericCharacterInfo(victimBody);
				GameEventManager.BeforeTakeDamage?.Invoke(damageInfo, attackerInfo, victimInfo);
			}

			public void OnTakeDamageServer(DamageReport damageReport)
			{
				if (Object.op_Implicit((Object)(object)victimBody) && GameEventManager.OnTakeDamage != null)
				{
					GameEventManager.OnTakeDamage(damageReport);
				}
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Awake <>9__12_0;

			public static hook_OnHitEnemy <>9__12_1;

			internal void <Init>b__12_0(orig_Awake orig, HealthComponent self)
			{
				((Component)self).gameObject.AddComponent<GenericDamageEvent>();
				orig.Invoke(self);
			}

			internal void <Init>b__12_1(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
			{
				orig.Invoke(self, damageInfo, victim);
				if (Object.op_Implicit((Object)(object)damageInfo.attacker))
				{
					CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
					CharacterBody body = (Object.op_Implicit((Object)(object)victim) ? victim.GetComponent<CharacterBody>() : null);
					GenericCharacterInfo attackerInfo = new GenericCharacterInfo(component);
					GenericCharacterInfo victimInfo = new GenericCharacterInfo(body);
					GameEventManager.OnHitEnemy?.Invoke(damageInfo, attackerInfo, victimInfo);
				}
			}
		}

		public static event DamageAttackerVictimEventHandler OnHitEnemy;

		public static event DamageAttackerVictimEventHandler BeforeTakeDamage;

		public static event DamageReportEventHandler OnTakeDamage;

		internal static void Init()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			object obj = <>c.<>9__12_0;
			if (obj == null)
			{
				hook_Awake val = delegate(orig_Awake orig, HealthComponent self)
				{
					((Component)self).gameObject.AddComponent<GenericDamageEvent>();
					orig.Invoke(self);
				};
				<>c.<>9__12_0 = val;
				obj = (object)val;
			}
			HealthComponent.Awake += (hook_Awake)obj;
			object obj2 = <>c.<>9__12_1;
			if (obj2 == null)
			{
				hook_OnHitEnemy val2 = delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
				{
					orig.Invoke(self, damageInfo, victim);
					if (Object.op_Implicit((Object)(object)damageInfo.attacker))
					{
						CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
						CharacterBody body = (Object.op_Implicit((Object)(object)victim) ? victim.GetComponent<CharacterBody>() : null);
						GenericCharacterInfo attackerInfo = new GenericCharacterInfo(component);
						GenericCharacterInfo victimInfo = new GenericCharacterInfo(body);
						GameEventManager.OnHitEnemy?.Invoke(damageInfo, attackerInfo, victimInfo);
					}
				};
				<>c.<>9__12_1 = val2;
				obj2 = (object)val2;
			}
			GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj2;
		}
	}
	public static class ItemManager
	{
		public enum TacticTier
		{
			Normal,
			Radiant,
			Artifact
		}

		public static List<ItemDef> normalList = new List<ItemDef>();

		public static List<ItemDef> radiantList = new List<ItemDef>();

		public static List<ItemDef> artifactList = new List<ItemDef>();

		public static ItemDef GenerateItem(string name, ItemTag[] tags, TacticTier tTier)
		{
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
			((Object)val).name = "ROT_" + name.ToUpperInvariant();
			val.AutoPopulateTokens();
			switch (tTier)
			{
			case TacticTier.Normal:
				SetItemTier(val, (ItemTier)1);
				break;
			case TacticTier.Radiant:
				SetItemTier(val, (ItemTier)4);
				break;
			case TacticTier.Artifact:
				SetItemTier(val, (ItemTier)2);
				break;
			}
			GameObject val2 = AssetManager.bundle.LoadAsset<GameObject>(name + ".prefab");
			if ((Object)(object)val2 == (Object)null)
			{
				Log.Warning("Missing prefab file for item " + ((Object)val).name + ". Substituting default...");
				val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion();
			}
			ModelPanelParameters val3 = val2.AddComponent<ModelPanelParameters>();
			val3.focusPointTransform = val2.transform;
			val3.cameraPositionTransform = val2.transform;
			val3.maxDistance = 10f;
			val3.minDistance = 5f;
			val.pickupIconSprite = AssetManager.bundle.LoadAsset<Sprite>(name + ".png");
			val.pickupModelPrefab = val2;
			val.canRemove = true;
			val.hidden = false;
			val.tags = tags;
			ItemDisplayRuleDict val4 = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			ItemAPI.Add(new CustomItem(val, val4));
			switch (tTier)
			{
			case TacticTier.Normal:
				normalList.Add(val);
				break;
			case TacticTier.Radiant:
				radiantList.Add(val);
				break;
			case TacticTier.Artifact:
				artifactList.Add(val);
				break;
			}
			return val;
		}

		public static void SetItemTier(ItemDef itemDef, ItemTier tier)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_001c: Invalid comparison between Unknown and I4
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if ((int)tier == 5)
			{
				try
				{
					itemDef.deprecatedTier = tier;
				}
				catch (Exception arg)
				{
					Log.Warning($"Error setting deprecatedTier for {((Object)itemDef).name}: {arg}");
				}
			}
			((ResourceAvailability)(ref ItemTierCatalog.availability)).CallWhenAvailable((Action)delegate
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)itemDef))
				{
					itemDef.tier = tier;
				}
			});
		}
	}
}
namespace RiskOfTactics.Extensions
{
	internal class Integrations
	{
		internal static bool lookingGlassEnabled;

		internal static void Init()
		{
			Dictionary<string, PluginInfo> pluginInfos = Chainloader.PluginInfos;
			if (pluginInfos.ContainsKey("droppod.lookingglass"))
			{
				try
				{
					Log.Debug("Running code injection for LookingGlass.");
					LookingGlassIntegration.Init();
					lookingGlassEnabled = true;
				}
				catch (Exception data)
				{
					Log.Error(data);
				}
			}
		}
	}
	internal static class LookingGlassIntegration
	{
		public static class LookingGlassStats
		{
			private readonly struct ItemStatLine
			{
				public string Name { get; }

				public ValueType ValueType { get; }

				public MeasurementUnits Units { get; }

				public ItemStatLine(string n, ValueType v, MeasurementUnits u)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					Name = n;
					ValueType = v;
					Units = u;
				}
			}

			public static void RegisterStats()
			{
				if (BrambleVest.isEnabled.Value)
				{
					RegisterStatsForItemWithRadiantVariant(BrambleVest.itemDef, BrambleVest.radiantDef, new List<ItemStatLine>(1)
					{
						new ItemStatLine("Damage Reflected: ", (ValueType)1, (MeasurementUnits)4)
					}, delegate(CharacterMaster master, int itemCount)
					{
						List<float> list2 = new List<float>();
						if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && Object.op_Implicit((Object)(object)((Component)master.inventory).GetComponent<BrambleVest.Statistics>()))
						{
							list2.Add(((Component)master.inventory).GetComponent<BrambleVest.Statistics>().DamageReflected);
						}
						else
						{
							list2.Add(0f);
						}
						return list2;
					});
				}
				if (SpearOfShojin.isEnabled.Value)
				{
					RegisterStatsForItemWithRadiantVariant(SpearOfShojin.itemDef, SpearOfShojin.radiantDef, new List<ItemStatLine>(1)
					{
						new ItemStatLine("On-Hit Reduction: ", (ValueType)2, (MeasurementUnits)1)
					}, (CharacterMaster master, int itemCount) => new List<float>(1) { Utilities.GetHyperbolicStacking(SpearOfShojin.percentCooldownOnHit * (float)ConfigManager.Scaling.radiantItemStatMultiplier, SpearOfShojin.percentCooldownOnHitExtraStacks * (float)ConfigManager.Scaling.radiantItemStatMultiplier, itemCount) });
				}
				if (GamblersBlade.isEnabled.Value)
				{
					RegisterStatsForItem(GamblersBlade.itemDef, new List<ItemStatLine>(1)
					{
						new ItemStatLine("Max Money Threshold: ", (ValueType)16, (MeasurementUnits)5)
					}, (CharacterMaster master, int itemCount) => new List<float>(1) { (float)GamblersBlade.moneyEffectCap.Value * Utilities.GetDifficultyAsMultiplier() });
				}
				if (!HorizonFocus.isEnabled.Value)
				{
					return;
				}
				RegisterStatsForItem(HorizonFocus.itemDef, new List<ItemStatLine>(2)
				{
					new ItemStatLine("Stun Chance: ", (ValueType)2, (MeasurementUnits)1),
					new ItemStatLine("Explosion Damage: ", (ValueType)3, (MeasurementUnits)7)
				}, delegate(CharacterMaster master, int itemCount)
				{
					List<float> list = new List<float>();
					if (Object.op_Implicit((Object)(object)master))
					{
						list.Add(Utilities.GetChanceAfterLuck(HorizonFocus.percentStunChance, master.luck));
					}
					else
					{
						list.Add(HorizonFocus.percentStunChance);
					}
					list.Add(Utilities.GetHyperbolicStacking(HorizonFocus.percentLightningDamage, HorizonFocus.percentLightningDamageExtraStacks, itemCount));
					return list;
				});
			}

			private static void RegisterStatsForItemWithRadiantVariant(ItemDef defaultItem, ItemDef radiantItem, List<ItemStatLine> statLines, Func<CharacterMaster, int, List<float>> func)
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Expected O, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Expected I4, but got Unknown
				ItemDef[] array = (ItemDef[])(object)new ItemDef[2] { defaultItem, radiantItem };
				foreach (ItemDef val in array)
				{
					if (!Object.op_Implicit((Object)(object)val))
					{
						throw new ArgumentNullException("itemDef");
					}
					ItemStatsDef val2 = new ItemStatsDef();
					foreach (ItemStatLine statLine in statLines)
					{
						val2.descriptions.Add(statLine.Name);
						val2.valueTypes.Add(statLine.ValueType);
						val2.measurementUnits.Add(statLine.Units);
					}
					val2.calculateValues = func;
					ItemDefinitions.allItemDefinitions.Add((int)val.itemIndex, val2);
				}
			}

			private static void RegisterStatsForItem(ItemDef itemDef, List<ItemStatLine> statLines, Func<CharacterMaster, int, List<float>> func)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				//IL_004d: 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_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Expected I4, but got Unknown
				if (!Object.op_Implicit((Object)(object)itemDef))
				{
					throw new ArgumentNullException("itemDef");
				}
				ItemStatsDef val = new ItemStatsDef();
				foreach (ItemStatLine statLine in statLines)
				{
					val.descriptions.Add(statLine.Name);
					val.valueTypes.Add(statLine.ValueType);
					val.measurementUnits.Add(statLine.Units);
				}
				val.calculateValues = func;
				ItemDefinitions.allItemDefinitions.Add((int)itemDef.itemIndex, val);
			}
		}

		internal static void Init()
		{
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LookingGlassStats.RegisterStats));
		}
	}
}
namespace RiskOfTactics.Content.Items.Completes
{
	internal class AdaptiveHelm
	{
		public static ItemDef itemDef;

		public static BuffDef cooldownResetBuff;

		public static ItemDef radiantDef;

		public static BuffDef radiantCooldownResetBuff;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Adaptive Helm", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" });

		public static ConfigurableValue<float> commonStatBoost = new ConfigurableValue<float>("Item: Adaptive Helm", "Common Stat Boost", 10f, "Base armor and % max HP shield for all users.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> meleeResistBonus = new ConfigurableValue<float>("Item: Adaptive Helm - Melee", "Bonus Resist", 40f, "Melee: Armor and % shield bonus for melee users for the first stack.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> meleeResistBonusExtraStacks = new ConfigurableValue<float>("Item: Adaptive Helm - Melee", "Bonus Resist Extra Stacks", 30f, "Melee: Armor and % shield bonus for melee users with extra stacks.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> cooldownRefundOnTakeDamage = new ConfigurableValue<float>("Item: Adaptive Helm - Melee", "Cooldown Refund", 0.5f, "Melee: Seconds cooldown refunded when taking damage.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> rangedDamageBonus = new ConfigurableValue<float>("Item: Adaptive Helm - Ranged", "Bonus Damage", 5f, "Flat damage bonus for ranged users for the first stack.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> rangedDamageBonusExtraStacks = new ConfigurableValue<float>("Item: Adaptive Helm - Ranged", "Bonus Damage Extra Stacks", 3f, "Flat damage bonus for ranged users with extra stacks.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> cooldownRefreshInterval = new ConfigurableValue<float>("Item: Adaptive Helm - Ranged", "Cooldown Interval", 20f, "All cooldowns are refunded on this interval for ranged item users.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" });

		public static ConfigurableValue<float> cooldownRefreshIntervalReduction = new ConfigurableValue<float>("Item: Adaptive Helm - Ranged", "Cooldown Interval Reduction", 20f, "Cooldown refund timer for this item is reduced by this percentage per stack for ranged users.", new List<string>(1) { "ITEM_ROT_ADAPTIVEHELM_DESC" });

		public static readonly float percentCommonStatBoost = commonStatBoost.Value / 100f;

		public static readonly float percentMeleeResistBonus = meleeResistBonus.Value / 100f;

		public static readonly float percentMeleeResistBonusExtraStacks = meleeResistBonusExtraStacks.Value / 100f;

		public static readonly float percentCooldownRefreshIntervalReduction = cooldownRefreshIntervalReduction.Value / 100f;

		internal static void Init()
		{
			ItemTag[] array = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			itemDef = ItemManager.GenerateItem("AdaptiveHelm", (ItemTag[])(object)array, ItemManager.TacticTier.Normal);
			ItemTag[] array2 = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			radiantDef = ItemManager.GenerateItem("Radiant_AdaptiveHelm", (ItemTag[])(object)array2, ItemManager.TacticTier.Radiant);
			cooldownResetBuff = Utilities.GenerateBuffDef("CooldownReset", AssetManager.bundle.LoadAsset<Sprite>("AdaptiveHelm.png"), canStack: false, isHidden: false, isDebuff: false, isCooldown: true);
			ContentAddition.AddBuffDef(cooldownResetBuff);
			radiantCooldownResetBuff = Utilities.GenerateBuffDef("Radiant_CooldownReset", AssetManager.bundle.LoadAsset<Sprite>("Radiant_AdaptiveHelm.png"), canStack: false, isHidden: false, isDebuff: false, isCooldown: true);
			ContentAddition.AddBuffDef(radiantCooldownResetBuff);
			Hooks(itemDef, ItemManager.TacticTier.Normal, cooldownResetBuff);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant, radiantCooldownResetBuff);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier, BuffDef cooldownReset)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			CharacterBody.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory) && Utilities.IsRangedBodyPrefab(((Component)self).gameObject))
				{
					int itemCountEffective3 = self.inventory.GetItemCountEffective(def);
					if (itemCountEffective3 > 0 && !self.HasBuff(cooldownReset))
					{
						self.AddTimedBuff(cooldownReset, Utilities.GetReverseExponentialStacking(cooldownRefreshInterval.Value, percentCooldownRefreshIntervalReduction, itemCountEffective3));
					}
				}
			};
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCountEffective2 = sender.inventory.GetItemCountEffective(def);
					if (itemCountEffective2 > 0)
					{
						args.armorAdd += Utilities.GetLinearStacking(commonStatBoost.Value * radiantMultiplier, 0f, itemCountEffective2);
						args.baseShieldAdd += sender.healthComponent.fullHealth * Utilities.GetLinearStacking(percentCommonStatBoost * radiantMultiplier, 0f, itemCountEffective2);
						if (Utilities.IsMeleeBodyPrefab(((Component)sender).gameObject))
						{
							args.armorTotalMult *= 1f + Utilities.GetLinearStacking(percentMeleeResistBonus * radiantMultiplier, percentMeleeResistBonusExtraStacks * radiantMultiplier, itemCountEffective2);
							args.shieldTotalMult *= 1f + Utilities.GetLinearStacking(percentMeleeResistBonus * radiantMultiplier, percentMeleeResistBonusExtraStacks * radiantMultiplier, itemCountEffective2);
						}
						if (Utilities.IsRangedBodyPrefab(((Component)sender).gameObject))
						{
							args.baseDamageAdd += Utilities.GetLinearStacking(rangedDamageBonus.Value * radiantMultiplier, rangedDamageBonusExtraStacks.Value * radiantMultiplier, itemCountEffective2);
						}
					}
				}
			};
			CharacterBody.OnBuffFinalStackLost += (hook_OnBuffFinalStackLost)delegate(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
			{
				orig.Invoke(self, buffDef);
				if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.skillLocator) && (Object)(object)buffDef == (Object)(object)cooldownReset)
				{
					self.skillLocator.ResetSkills();
				}
			};
			GameEventManager.OnTakeDamage += delegate(DamageReport damageReport)
			{
				CharacterBody victimBody = damageReport.victimBody;
				if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.inventory) && Object.op_Implicit((Object)(object)victimBody.skillLocator) && Utilities.IsMeleeBodyPrefab(((Component)victimBody).gameObject))
				{
					int itemCountEffective = victimBody.inventory.GetItemCountEffective(def);
					if (itemCountEffective > 0)
					{
						victimBody.skillLocator.DeductCooldownFromAllSkillsServer(cooldownRefundOnTakeDamage.Value * radiantMultiplier);
					}
				}
			};
		}
	}
	internal class ArchangelsStaff
	{
		public class Statistics : MonoBehaviour
		{
			public class Sync : INetMessage, ISerializableObject
			{
				private NetworkInstanceId objId;

				private float lastTick;

				public Sync()
				{
				}

				public Sync(NetworkInstanceId objId, float tick)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					this.objId = objId;
					lastTick = tick;
				}

				public 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)
					objId = reader.ReadNetworkId();
					lastTick = reader.ReadSingle();
				}

				public void OnReceived()
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					if (NetworkServer.active)
					{
						return;
					}
					GameObject val = Util.FindNetworkObject(objId);
					if ((Object)(object)val != (Object)null)
					{
						Statistics component = val.GetComponent<Statistics>();
						if ((Object)(object)component != (Object)null)
						{
							component.LastTick = lastTick;
						}
					}
				}

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

			private float _lastTick;

			public float LastTick
			{
				get
				{
					return _lastTick;
				}
				set
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					_lastTick = value;
					if (NetworkServer.active)
					{
						NetMessageExtensions.Send((INetMessage)(object)new Sync(((Component)this).gameObject.GetComponent<NetworkIdentity>().netId, value), (NetworkDestination)1);
					}
				}
			}
		}

		public static ItemDef itemDef;

		public static BuffDef foresightBuff;

		public static ItemDef radiantDef;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Archangels Staff", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_ARCHANGELSSTAFF_DESC" });

		public static ConfigurableValue<float> flatDamagePerTick = new ConfigurableValue<float>("Item: Archangels Staff", "Flat Damage Per Tick", 0.5f, "Flat damage gained per item proc.", new List<string>(1) { "ITEM_ROT_ARCHANGELSSTAFF_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> tickDuration = new ConfigurableValue<float>("Item: Archangels Staff", "Tick Duration", 5f, "Number of seconds between item procs.", new List<string>(1) { "ITEM_ROT_ARCHANGELSSTAFF_DESC" });

		internal static void Init()
		{
			itemDef = ItemManager.GenerateItem("ArchangelsStaff", (ItemTag[])(object)new ItemTag[2]
			{
				(ItemTag)1,
				(ItemTag)31
			}, ItemManager.TacticTier.Normal);
			radiantDef = ItemManager.GenerateItem("Radiant_ArchangelsStaff", (ItemTag[])(object)new ItemTag[2]
			{
				(ItemTag)1,
				(ItemTag)31
			}, ItemManager.TacticTier.Radiant);
			NetworkingAPI.RegisterMessageType<Statistics.Sync>();
			foresightBuff = Utilities.GenerateBuffDef("Foresight", AssetManager.bundle.LoadAsset<Sprite>("Foresight.png"), canStack: true, isHidden: false, isDebuff: false, isCooldown: false);
			ContentAddition.AddBuffDef(foresightBuff);
			Hooks(itemDef, ItemManager.TacticTier.Normal);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			CharacterMaster.onStartGlobal += delegate(CharacterMaster obj)
			{
				Inventory inventory = obj.inventory;
				if (inventory != null)
				{
					((Component)inventory).gameObject.AddComponent<Statistics>();
				}
			};
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCountEffective2 = sender.inventory.GetItemCountEffective(def);
					if (itemCountEffective2 > 0)
					{
						int buffCount = sender.GetBuffCount(foresightBuff);
						args.baseDamageAdd += (float)buffCount * flatDamagePerTick.Value * radiantMultiplier;
					}
				}
			};
			Stage.onStageStartGlobal += delegate
			{
				foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
				{
					CharacterMaster val = readOnlyInstances.masterController.master ?? readOnlyInstances.master;
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory) && val.inventory.GetItemCountEffective(def) > 0)
					{
						Statistics component2 = ((Component)val.inventory).GetComponent<Statistics>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							component2.LastTick = Environment.TickCount;
						}
					}
				}
			};
			CharacterBody.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, CharacterBody self)
			{
				orig.Invoke(self);
				foreach (HoldoutZoneController instances in InstanceTracker.GetInstancesList<HoldoutZoneController>())
				{
					if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory))
					{
						int itemCountEffective = self.inventory.GetItemCountEffective(def);
						if (itemCountEffective > 0 && ((Behaviour)instances).isActiveAndEnabled)
						{
							Statistics component = ((Component)self.inventory).GetComponent<Statistics>();
							if (Object.op_Implicit((Object)(object)component) && (float)Environment.TickCount - component.LastTick > tickDuration.Value * 1000f)
							{
								self.AddBuff(foresightBuff);
								component.LastTick = Environment.TickCount;
							}
						}
					}
				}
			};
		}
	}
	internal class Bloodthirster
	{
		public static ItemDef itemDef;

		public static BuffDef satedBuff;

		public static ItemDef radiantDef;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Bloodthirster", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_BLOODTHIRSTER_DESC" });

		public static ConfigurableValue<float> effectCooldown = new ConfigurableValue<float>("Item: Bloodthirster", "Effect Cooldown", 20f, "Cooldown of this item's effect.", new List<string>(1) { "ITEM_ROT_BLOODTHIRSTER_DESC" });

		public static ConfigurableValue<float> barrierTriggerHP = new ConfigurableValue<float>("Item: Bloodthirster", "HP Threshold", 20f, "Threshold needed to fall below in order to trigger this item's effect.", new List<string>(1) { "ITEM_ROT_BLOODTHIRSTER_DESC" });

		public static ConfigurableValue<float> barrierSize = new ConfigurableValue<float>("Item: Bloodthirster", "Percent Barrier", 25f, "Percent max HP barrier given when this item is procced.", new List<string>(1) { "ITEM_ROT_BLOODTHIRSTER_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> barrierSizeExtraStacks = new ConfigurableValue<float>("Item: Bloodthirster", "Percent Barrier Extra Stacks", 50f, "Percent max HP barrier given when extra stacks of item are procced.", new List<string>(1) { "ITEM_ROT_BLOODTHIRSTER_DESC" }, isRadiantStat: true);

		private static readonly float percentBarrierTriggerHP = barrierTriggerHP.Value / 100f;

		private static readonly float percentBarrierSize = barrierSize.Value / 100f;

		private static readonly float percentBarrierSizeExtraStacks = barrierSizeExtraStacks.Value / 100f;

		internal static void Init()
		{
			ItemTag[] array = new ItemTag[4];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			itemDef = ItemManager.GenerateItem("Bloodthirster", (ItemTag[])(object)array, ItemManager.TacticTier.Normal);
			ItemTag[] array2 = new ItemTag[4];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			radiantDef = ItemManager.GenerateItem("Radiant_Bloodthirster", (ItemTag[])(object)array2, ItemManager.TacticTier.Radiant);
			satedBuff = Utilities.GenerateBuffDef("Sated", AssetManager.bundle.LoadAsset<Sprite>("Sated.png"), canStack: false, isHidden: false, isDebuff: false, isCooldown: true);
			ContentAddition.AddBuffDef(satedBuff);
			Hooks(itemDef, ItemManager.TacticTier.Normal);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier)
		{
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			GameEventManager.OnTakeDamage += delegate(DamageReport damageReport)
			{
				CharacterBody victimBody = damageReport.victimBody;
				if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.inventory) && Object.op_Implicit((Object)(object)victimBody.healthComponent))
				{
					int itemCountEffective = victimBody.inventory.GetItemCountEffective(def);
					if (itemCountEffective > 0 && !victimBody.HasBuff(satedBuff) && victimBody.healthComponent.combinedHealthFraction < percentBarrierTriggerHP)
					{
						victimBody.healthComponent.AddBarrier(victimBody.healthComponent.fullCombinedHealth * Utilities.GetLinearStacking(percentBarrierSize * radiantMultiplier, percentBarrierSizeExtraStacks * radiantMultiplier, itemCountEffective));
						victimBody.AddTimedBuff(satedBuff, (float)effectCooldown);
					}
				}
			};
		}
	}
	internal class BrambleVest
	{
		public class Statistics : MonoBehaviour
		{
			public class Sync : INetMessage, ISerializableObject
			{
				private NetworkInstanceId objId;

				private float damageReflected;

				public Sync()
				{
				}

				public Sync(NetworkInstanceId objId, float damage)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					this.objId = objId;
					damageReflected = damage;
				}

				public 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)
					objId = reader.ReadNetworkId();
					damageReflected = reader.ReadSingle();
				}

				public void OnReceived()
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					if (NetworkServer.active)
					{
						return;
					}
					GameObject val = Util.FindNetworkObject(objId);
					if ((Object)(object)val != (Object)null)
					{
						Statistics component = val.GetComponent<Statistics>();
						if ((Object)(object)component != (Object)null)
						{
							component.DamageReflected = damageReflected;
						}
					}
				}

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

			private float _damageReflected;

			public float DamageReflected
			{
				get
				{
					return _damageReflected;
				}
				set
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					_damageReflected = value;
					if (NetworkServer.active)
					{
						NetMessageExtensions.Send((INetMessage)(object)new Sync(((Component)this).gameObject.GetComponent<NetworkIdentity>().netId, value), (NetworkDestination)1);
					}
				}
			}
		}

		public class BrambleOrb : Orb
		{
			private readonly float speed = 60f;

			private readonly float multi;

			private readonly DamageReport damageReport;

			public BrambleOrb(DamageReport report, float radiantMult)
			{
				//IL_005c: 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_0061: Unknown result type (might be due to invalid IL or missing references)
				damageReport = report;
				multi = radiantMult;
				if (Object.op_Implicit((Object)(object)report.victimBody) && Object.op_Implicit((Object)(object)report.attackerBody))
				{
					base.origin = (Object.op_Implicit((Object)(object)report.victimBody) ? report.victimBody.corePosition : Vector3.zero);
					if (Object.op_Implicit((Object)(object)report.attackerBody))
					{
						base.target = report.attackerBody.mainHurtBox;
					}
				}
			}

			public override void Begin()
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				((Orb)this).duration = ((Orb)this).distanceToTarget / speed;
				EffectData val = new EffectData
				{
					origin = base.origin,
					genericFloat = ((Orb)this).duration
				};
				val.SetHurtBoxReference(base.target);
				EffectManager.SpawnEffect(OrbStorageUtility.Get("Prefabs/Effects/OrbEffects/ClayGooOrbEffect"), val, true);
			}

			public override void OnArrival()
			{
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: 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_00d1: 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_00ed: 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_00fb: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)damageReport.attackerBody) && Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)damageReport.victimBody.inventory))
				{
					CharacterBody victimBody = damageReport.victimBody;
					CharacterBody attackerBody = damageReport.attackerBody;
					int itemCountEffective = damageReport.victimBody.inventory.GetItemCountEffective(itemDef);
					DamageInfo val = new DamageInfo
					{
						damage = damageReport.damageInfo.damage * Utilities.GetLinearStacking(percentReflectDamage * multi, itemCountEffective),
						damageColorIndex = (DamageColorIndex)4,
						damageType = DamageTypeCombo.op_Implicit((DamageType)0),
						attacker = ((Component)victimBody).gameObject,
						crit = victimBody.RollCrit(),
						inflictor = ((Component)victimBody).gameObject,
						procCoefficient = reflectProcCoefficient,
						procChainMask = default(ProcChainMask)
					};
					attackerBody.healthComponent.TakeDamage(val);
					CharacterBody minionOwnershipParentBody = Utilities.GetMinionOwnershipParentBody(damageReport.victimBody);
					Statistics component = ((Component)victimBody.inventory).GetComponent<Statistics>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.DamageReflected += val.damage;
					}
				}
			}
		}

		public static ItemDef itemDef;

		public static ItemDef radiantDef;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Bramble Vest", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_BRAMBLEVEST_DESC" });

		public static ConfigurableValue<float> healthBonus = new ConfigurableValue<float>("Item: Bramble Vest", "Health", 5f, "Percent health bonus when holding this item.", new List<string>(1) { "ITEM_ROT_BRAMBLEVEST_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<int> flatDamageReduction = new ConfigurableValue<int>("Item: Bramble Vest", "Damage Reduction", 5, "Flat damage reduction bonus when holding this item.", new List<string>(1) { "ITEM_ROT_BRAMBLEVEST_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> reflectDamage = new ConfigurableValue<float>("Item: Bramble Vest", "Reflect Percent", 100f, "Percent damage reflected back to the attacker when holding this item.", new List<string>(1) { "ITEM_ROT_BRAMBLEVEST_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> reflectProcCoefficient = new ConfigurableValue<float>("Item: Bramble Vest", "Reflect Proc Coefficient", 0.5f, "Proc coefficient for the reflected damage hit when holding this item.", new List<string>(1) { "ITEM_ROT_BRAMBLEVEST_DESC" });

		public static readonly float percentHealthBonus = healthBonus.Value / 100f;

		public static readonly float percentReflectDamage = reflectDamage.Value / 100f;

		internal static void Init()
		{
			ItemTag[] array = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			itemDef = ItemManager.GenerateItem("BrambleVest", (ItemTag[])(object)array, ItemManager.TacticTier.Normal);
			ItemTag[] array2 = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			radiantDef = ItemManager.GenerateItem("Radiant_BrambleVest", (ItemTag[])(object)array2, ItemManager.TacticTier.Radiant);
			NetworkingAPI.RegisterMessageType<Statistics.Sync>();
			Hooks(itemDef, ItemManager.TacticTier.Normal);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			CharacterMaster.onStartGlobal += delegate(CharacterMaster obj)
			{
				Inventory inventory = obj.inventory;
				if (inventory != null)
				{
					((Component)inventory).gameObject.AddComponent<Statistics>();
				}
			};
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCountEffective3 = sender.inventory.GetItemCountEffective(def);
					if (itemCountEffective3 > 0)
					{
						args.healthTotalMult *= 1f + percentHealthBonus * radiantMultiplier;
					}
				}
			};
			GameEventManager.BeforeTakeDamage += delegate(DamageInfo damageInfo, GameEventManager.GenericCharacterInfo attackerInfo, GameEventManager.GenericCharacterInfo victimInfo)
			{
				CharacterBody body = victimInfo.body;
				if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory))
				{
					int itemCountEffective2 = body.inventory.GetItemCountEffective(def);
					if (itemCountEffective2 > 0)
					{
						damageInfo.damage = ((damageInfo.damage > (float)flatDamageReduction.Value * radiantMultiplier + 1f) ? (damageInfo.damage - (float)flatDamageReduction.Value * radiantMultiplier) : 1f);
					}
				}
			};
			GameEventManager.OnTakeDamage += delegate(DamageReport damageReport)
			{
				CharacterBody victimBody = damageReport.victimBody;
				CharacterBody attackerBody = damageReport.attackerBody;
				if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.inventory) && Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.healthComponent))
				{
					int itemCountEffective = victimBody.inventory.GetItemCountEffective(def);
					if (itemCountEffective > 0 && !Utilities.OnSameTeam(victimBody, attackerBody))
					{
						OrbManager.instance.AddOrb((Orb)(object)new BrambleOrb(damageReport, radiantMultiplier));
					}
				}
			};
		}
	}
	internal class Crownguard
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnBuffFinalStackLost <>9__13_1;

			internal void <Hooks>b__13_1(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
			{
				orig.Invoke(self, buffDef);
				if (Object.op_Implicit((Object)(object)self) && (Object)(object)buffDef == (Object)(object)guardedBuff)
				{
					self.AddBuff(crownedBuff);
				}
			}
		}

		public static ItemDef itemDef;

		public static BuffDef guardedBuff;

		public static BuffDef crownedBuff;

		public static ItemDef radiantDef;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Crownguard", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_CROWNGUARD_DESC" });

		public static ConfigurableValue<float> effectShield = new ConfigurableValue<float>("Item: Crownguard", "Effect Shield", 25f, "Percent max HP shield bonus when teleporter is activated.", new List<string>(1) { "ITEM_ROT_CROWNGUARD_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> effectShieldExtraStacks = new ConfigurableValue<float>("Item: Crownguard", "Effect Shield Extra Stacks", 25f, "Percent max HP shield bonus with extra stacks when teleporter is activated.", new List<string>(1) { "ITEM_ROT_CROWNGUARD_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> effectDuration = new ConfigurableValue<float>("Item: Crownguard", "Effect Duration", 30f, "How long the shield effect lasts when teleporter is activated.", new List<string>(1) { "ITEM_ROT_CROWNGUARD_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> effectDamage = new ConfigurableValue<float>("Item: Crownguard", "Effect Damage", 4f, "Damage bonus given after the shield effect expires.", new List<string>(1) { "ITEM_ROT_CROWNGUARD_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> effectDamageExtraStacks = new ConfigurableValue<float>("Item: Crownguard", "Effect Damage Extra Stacks", 1.5f, "Damage bonus given after the shield effect expires.", new List<string>(1) { "ITEM_ROT_CROWNGUARD_DESC" }, isRadiantStat: true);

		private static readonly float percentEffectShield = effectShield.Value / 100f;

		private static readonly float percentEffectShieldExtraStacks = effectShieldExtraStacks.Value / 100f;

		internal static void Init()
		{
			ItemTag[] array = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			itemDef = ItemManager.GenerateItem("Crownguard", (ItemTag[])(object)array, ItemManager.TacticTier.Normal);
			ItemTag[] array2 = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			radiantDef = ItemManager.GenerateItem("Radiant_Crownguard", (ItemTag[])(object)array2, ItemManager.TacticTier.Radiant);
			guardedBuff = Utilities.GenerateBuffDef("Guarded", AssetManager.bundle.LoadAsset<Sprite>("Guarded.png"), canStack: false, isHidden: false, isDebuff: false, isCooldown: true);
			ContentAddition.AddBuffDef(guardedBuff);
			crownedBuff = Utilities.GenerateBuffDef("Crowned", AssetManager.bundle.LoadAsset<Sprite>("Crowned.png"), canStack: false, isHidden: false, isDebuff: false, isCooldown: false);
			ContentAddition.AddBuffDef(crownedBuff);
			Hooks(itemDef, ItemManager.TacticTier.Normal);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCountEffective = sender.inventory.GetItemCountEffective(def);
					if (itemCountEffective > 0)
					{
						if (sender.GetBuffCount(guardedBuff) > 0)
						{
							args.baseShieldAdd += sender.healthComponent.fullHealth * Utilities.GetLinearStacking(percentEffectShield * radiantMultiplier, percentEffectShieldExtraStacks * radiantMultiplier, itemCountEffective);
						}
						if (sender.GetBuffCount(crownedBuff) > 0)
						{
							args.baseDamageAdd += Utilities.GetLinearStacking(effectDamage.Value * radiantMultiplier, effectDamageExtraStacks.Value * radiantMultiplier, itemCountEffective);
						}
					}
				}
			};
			object obj = <>c.<>9__13_1;
			if (obj == null)
			{
				hook_OnBuffFinalStackLost val = delegate(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
				{
					orig.Invoke(self, buffDef);
					if (Object.op_Implicit((Object)(object)self) && (Object)(object)buffDef == (Object)(object)guardedBuff)
					{
						self.AddBuff(crownedBuff);
					}
				};
				<>c.<>9__13_1 = val;
				obj = (object)val;
			}
			CharacterBody.OnBuffFinalStackLost += (hook_OnBuffFinalStackLost)obj;
			HoldoutZoneController.Awake += (hook_Awake)delegate(orig_Awake orig, HoldoutZoneController self)
			{
				orig.Invoke(self);
				foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
				{
					CharacterMaster val2 = readOnlyInstances.masterController.master ?? readOnlyInstances.master;
					if (Object.op_Implicit((Object)(object)val2))
					{
						CharacterBody body = val2.GetBody();
						if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCountEffective(def) > 0)
						{
							body.AddTimedBuff(guardedBuff, effectDuration.Value * radiantMultiplier);
						}
					}
				}
			};
		}
	}
	internal class DragonsClaw
	{
		public class Statistics : MonoBehaviour
		{
			public class Sync : INetMessage, ISerializableObject
			{
				private NetworkInstanceId objId;

				private float lastTick;

				public Sync()
				{
				}

				public Sync(NetworkInstanceId objId, float tick)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					this.objId = objId;
					lastTick = tick;
				}

				public 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)
					objId = reader.ReadNetworkId();
					lastTick = reader.ReadSingle();
				}

				public void OnReceived()
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					if (NetworkServer.active)
					{
						return;
					}
					GameObject val = Util.FindNetworkObject(objId);
					if ((Object)(object)val != (Object)null)
					{
						Statistics component = val.GetComponent<Statistics>();
						if ((Object)(object)component != (Object)null)
						{
							component.LastTick = lastTick;
						}
					}
				}

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

			private float _lastTick;

			public float LastTick
			{
				get
				{
					return _lastTick;
				}
				set
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					_lastTick = value;
					if (NetworkServer.active)
					{
						NetMessageExtensions.Send((INetMessage)(object)new Sync(((Component)this).gameObject.GetComponent<NetworkIdentity>().netId, value), (NetworkDestination)1);
					}
				}
			}
		}

		public static ItemDef itemDef;

		public static ItemDef radiantDef;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Dragons Claw", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_DRAGONSCLAW_DESC" });

		public static ConfigurableValue<float> maxHealthBonus = new ConfigurableValue<float>("Item: Dragons Claw", "Percent Health", 9f, "Percent max health bonus when holding this item.", new List<string>(1) { "ITEM_ROT_DRAGONSCLAW_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> maxHealthBonusExtraStacks = new ConfigurableValue<float>("Item: Dragons Claw", "Percent Health Per Stack", 9f, "Percent max health bonus when holding extra stacks of this item.", new List<string>(1) { "ITEM_ROT_DRAGONSCLAW_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> healingPerTick = new ConfigurableValue<float>("Item: Dragons Claw", "Healing Per Tick", 9f, "Percent max health healing per item proc.", new List<string>(1) { "ITEM_ROT_DRAGONSCLAW_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> tickDuration = new ConfigurableValue<float>("Item: Dragons Claw", "Tick Duration", 9f, "Number of seconds between item procs.", new List<string>(1) { "ITEM_ROT_DRAGONSCLAW_DESC" });

		public static readonly float percentHealingPerTick = healingPerTick.Value / 100f;

		public static readonly float percentMaxHealthBonus = maxHealthBonus.Value / 100f;

		public static readonly float percentMaxHealthBonusExtraStacks = maxHealthBonusExtraStacks.Value / 100f;

		internal static void Init()
		{
			ItemTag[] array = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			itemDef = ItemManager.GenerateItem("DragonsClaw", (ItemTag[])(object)array, ItemManager.TacticTier.Normal);
			ItemTag[] array2 = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			radiantDef = ItemManager.GenerateItem("Radiant_DragonsClaw", (ItemTag[])(object)array2, ItemManager.TacticTier.Radiant);
			NetworkingAPI.RegisterMessageType<Statistics.Sync>();
			Hooks(itemDef, ItemManager.TacticTier.Normal);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			CharacterMaster.onStartGlobal += delegate(CharacterMaster obj)
			{
				Inventory inventory = obj.inventory;
				if (inventory != null)
				{
					((Component)inventory).gameObject.AddComponent<Statistics>();
				}
			};
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCountEffective2 = sender.inventory.GetItemCountEffective(def);
					if (itemCountEffective2 > 0)
					{
						args.healthTotalMult *= 1f + Utilities.GetLinearStacking(percentMaxHealthBonus * radiantMultiplier, percentMaxHealthBonusExtraStacks * radiantMultiplier, itemCountEffective2);
					}
				}
			};
			Stage.onStageStartGlobal += delegate
			{
				foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
				{
					PlayerCharacterMasterController masterController = readOnlyInstances.masterController;
					CharacterMaster val = ((masterController != null) ? masterController.master : null) ?? readOnlyInstances.master;
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory) && val.inventory.GetItemCountEffective(def) > 0)
					{
						Statistics component2 = ((Component)val.inventory).GetComponent<Statistics>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							component2.LastTick = Environment.TickCount;
						}
					}
				}
			};
			CharacterBody.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, CharacterBody self)
			{
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory))
				{
					int itemCountEffective = self.inventory.GetItemCountEffective(def);
					if (itemCountEffective > 0)
					{
						Statistics component = ((Component)self.inventory).GetComponent<Statistics>();
						if (Object.op_Implicit((Object)(object)component) && (float)Environment.TickCount - component.LastTick > (float)tickDuration * 1000f)
						{
							self.healthComponent.Heal(self.healthComponent.fullHealth * percentHealingPerTick * radiantMultiplier, default(ProcChainMask), true);
							component.LastTick = Environment.TickCount;
							Utilities.SpawnHealEffect(self);
						}
					}
				}
			};
		}
	}
	internal class GuinsoosRageblade
	{
		public class Statistics : MonoBehaviour
		{
			public class Sync : INetMessage, ISerializableObject
			{
				private NetworkInstanceId objId;

				private GameObject lastTarget;

				public Sync()
				{
				}

				public Sync(NetworkInstanceId objId, GameObject tick)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					this.objId = objId;
					lastTarget = tick;
				}

				public 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)
					objId = reader.ReadNetworkId();
					lastTarget = reader.ReadGameObject();
				}

				public void OnReceived()
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					if (NetworkServer.active)
					{
						return;
					}
					GameObject val = Util.FindNetworkObject(objId);
					if ((Object)(object)val != (Object)null)
					{
						Statistics component = val.GetComponent<Statistics>();
						if ((Object)(object)component != (Object)null)
						{
							component.LastTarget = lastTarget;
						}
					}
				}

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

			private GameObject _lastTarget;

			public GameObject LastTarget
			{
				get
				{
					return _lastTarget;
				}
				set
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					_lastTarget = value;
					if (NetworkServer.active)
					{
						NetMessageExtensions.Send((INetMessage)(object)new Sync(((Component)this).gameObject.GetComponent<NetworkIdentity>().netId, value), (NetworkDestination)1);
					}
				}
			}
		}

		public static ItemDef itemDef;

		public static BuffDef wrathBuff;

		public static ItemDef radiantDef;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Guinsoos Rageblade", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_GUINSOOSRAGEBLADE_DESC" });

		public static ConfigurableValue<float> attackSpeedOnHit = new ConfigurableValue<float>("Item: Guinsoos Rageblade", "Attack Speed On-Hit", 3f, "Percent attack speed gained on-hit while hitting the same target.", new List<string>(1) { "ITEM_ROT_GUINSOOSRAGEBLADE_DESC" }, isRadiantStat: true);

		public static readonly float percentAttackSpeedOnHit = attackSpeedOnHit.Value / 100f;

		internal static void Init()
		{
			ItemTag[] array = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			itemDef = ItemManager.GenerateItem("GuinsoosRageblade", (ItemTag[])(object)array, ItemManager.TacticTier.Normal);
			ItemTag[] array2 = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			radiantDef = ItemManager.GenerateItem("Radiant_GuinsoosRageblade", (ItemTag[])(object)array2, ItemManager.TacticTier.Radiant);
			NetworkingAPI.RegisterMessageType<Statistics.Sync>();
			wrathBuff = Utilities.GenerateBuffDef("Wrath", AssetManager.bundle.LoadAsset<Sprite>("Wrath.png"), canStack: true, isHidden: false, isDebuff: false, isCooldown: false);
			ContentAddition.AddBuffDef(wrathBuff);
			Hooks(itemDef, ItemManager.TacticTier.Normal);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			CharacterMaster.onStartGlobal += delegate(CharacterMaster obj)
			{
				Inventory inventory = obj.inventory;
				if (inventory != null)
				{
					((Component)inventory).gameObject.AddComponent<Statistics>();
				}
			};
			CharacterBody.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, CharacterBody self)
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self) && self.HasBuff(wrathBuff) && Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCountEffective(def) == 0)
				{
					self.SetBuffCount(wrathBuff.buffIndex, 0);
				}
			};
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCountEffective = sender.inventory.GetItemCountEffective(def);
					int buffCount = sender.GetBuffCount(wrathBuff);
					if (buffCount > 0)
					{
						args.attackSpeedMultAdd += (float)buffCount * Utilities.GetHyperbolicStacking(percentAttackSpeedOnHit * radiantMultiplier, itemCountEffective);
					}
				}
			};
			GameEventManager.OnTakeDamage += delegate(DamageReport damageReport)
			{
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody victimBody = damageReport.victimBody;
				CharacterBody attackerBody = damageReport.attackerBody;
				if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && attackerBody.inventory.GetItemCountEffective(def) > 0 && Object.op_Implicit((Object)(object)victimBody.healthComponent) && !Utilities.OnSameTeam(victimBody, attackerBody))
				{
					Statistics component = ((Component)attackerBody.inventory).GetComponent<Statistics>();
					if (Object.op_Implicit((Object)(object)component) && ((object)((Component)victimBody).gameObject).Equals((object?)component.LastTarget))
					{
						attackerBody.AddBuff(wrathBuff);
					}
					else
					{
						attackerBody.SetBuffCount(wrathBuff.buffIndex, 1);
						component.LastTarget = ((Component)victimBody).gameObject;
					}
				}
			};
		}
	}
	internal class HandOfJustice
	{
		public static ItemDef itemDef;

		public static BuffDef aboveHalfBuff;

		public static BuffDef belowHalfBuff;

		public static ItemDef radiantDef;

		public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Hand Of Justice", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string>(1) { "ITEM_ROT_HANDOFJUSTICE_DESC" });

		public static ConfigurableValue<float> critChanceBonus = new ConfigurableValue<float>("Item: Hand Of Justice", "Crit Chance", 5f, "Crit chance gained when holding this item.", new List<string>(1) { "ITEM_ROT_HANDOFJUSTICE_DESC" });

		public static ConfigurableValue<float> scaledBonusDamageEffect = new ConfigurableValue<float>("Item: Hand Of Justice", "Bonus Damage Percent", 10f, "Percent BASE damage scaling effect gained for this item.", new List<string>(1) { "ITEM_ROT_HANDOFJUSTICE_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> scaledBonusDamageEffectExtraStacks = new ConfigurableValue<float>("Item: Hand Of Justice", "Bonus Damage Percent Per Stack", 10f, "Percent BASE damage scaling effect gained for extra stacks of this item.", new List<string>(1) { "ITEM_ROT_HANDOFJUSTICE_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> omnivampEffect = new ConfigurableValue<float>("Item: Hand Of Justice", "Omnivamp", 10f, "Percent omnivamp scaling effect gained for this item.", new List<string>(1) { "ITEM_ROT_HANDOFJUSTICE_DESC" }, isRadiantStat: true);

		public static ConfigurableValue<float> omnivampEffectExtraStacks = new ConfigurableValue<float>("Item: Hand Of Justice", "Omnivamp Per Stack", 10f, "Percent omnivamp scaling effect gained for extra stacks of this item.", new List<string>(1) { "ITEM_ROT_HANDOFJUSTICE_DESC" }, isRadiantStat: true);

		private static readonly float percentScaledBonusDamageEffect = scaledBonusDamageEffect.Value / 100f;

		private static readonly float percentScaledBonusDamageEffectExtraStacks = scaledBonusDamageEffectExtraStacks.Value / 100f;

		private static readonly float percentOmnivampEffect = omnivampEffect.Value / 100f;

		private static readonly float percentOmnivampEffectExtraStacks = omnivampEffectExtraStacks.Value / 100f;

		internal static void Init()
		{
			ItemTag[] array = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			itemDef = ItemManager.GenerateItem("HandOfJustice", (ItemTag[])(object)array, ItemManager.TacticTier.Normal);
			ItemTag[] array2 = new ItemTag[3];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			radiantDef = ItemManager.GenerateItem("Radiant_HandOfJustice", (ItemTag[])(object)array2, ItemManager.TacticTier.Radiant);
			aboveHalfBuff = Utilities.GenerateBuffDef("Above", AssetManager.bundle.LoadAsset<Sprite>("HoJ Damage.png"), canStack: false, isHidden: false, isDebuff: false, isCooldown: false);
			ContentAddition.AddBuffDef(aboveHalfBuff);
			belowHalfBuff = Utilities.GenerateBuffDef("Below", AssetManager.bundle.LoadAsset<Sprite>("HoJ Omnivamp.png"), canStack: false, isHidden: false, isDebuff: false, isCooldown: false);
			ContentAddition.AddBuffDef(belowHalfBuff);
			Hooks(itemDef, ItemManager.TacticTier.Normal);
			Hooks(radiantDef, ItemManager.TacticTier.Radiant);
		}

		public static void Hooks(ItemDef def, ItemManager.TacticTier tier)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			float radiantMultiplier = (tier.Equals(ItemManager.TacticTier.Radiant) ? ((float)ConfigManager.Scaling.radiantItemStatMultiplier) : 1f);
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody sender, StatHookEventArgs args)
			{
				if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
				{
					int itemCountEffective3 = sender.inventory.GetItemCountEffective(def);
					if (itemCountEffective3 > 0)
					{
						args.critAdd += critChanceBonus.Value;
						int num3 = ((!sender.HasBuff(aboveHalfBuff)) ? 1 : 2);
						args.damageTotalMult *= 1f + Utilities.GetLinearStacking(percentScaledBonusDamageEffect * radiantMultiplier, percentScaledBonusDamageEffectExtraStacks * radiantMultiplier, itemCountEffective3) * (float)num3;
					}
				}
			};
			GameEventManager.OnTakeDamage += delegate(DamageReport damageReport)
			{
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody victimBody = damageReport.victimBody;
				CharacterBody attackerBody = damageReport.attackerBody;
				if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory))
				{
					int itemCountEffective2 = attackerBody.inventory.GetItemCountEffective(def);
					if (itemCountEffective2 > 0 && !Utilities.OnSameTeam(victimBody, attackerBody) && Object.op_Implicit((Object)(object)attackerBody.healthComponent))
					{
						int num = ((!attackerBody.HasBuff(belowHalfBuff)) ? 1 : 2);
						float num2 = damageReport.damageInfo.damage * Utilities.GetHyperbolicStacking(percentOmnivampEffect * radiantMultiplier, percentOmnivampEffectExtraStacks * radiantMultiplier, itemCountEffective2) * (float)num;
						attackerBody.healthComponent.Heal(num2, default(ProcChainMask), true);
						Utilities.SpawnHealEffect(attackerBody);
					}
				}
			};
			CharacterBody.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, CharacterBody self)
			{
				if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory) && Object.op_Implicit((Object)(object)self.healthComponent))
				{
					int itemCountEffective = self.inventory.GetItemCountEffective(def);
					if (itemCountEffective > 0)
					{
						if (self.healthComponent.combinedHealthFraction >= 0.5f)
						{
							if (!self.HasBuff(aboveHalfBuff))
							{
								self.AddBuff(aboveHalfBuff);
							}
							if (self.HasBuff(belowHalfBuff))
							{
								self.RemoveBuff(belowHalfBuff);
							}
						}
						else
						{
							if (!self.HasBuff(belowHalfBuff))
							{
								self.AddBuff(belowHalfBuff);
							}
							if (self.HasBuff(aboveHalfBuff))
							{
								self.RemoveBuff(aboveHalfBuff);
							}
						}
					}
					else
					{
						self.RemoveBuff(aboveHalfBuff);
						self.RemoveBuff(belowHalfBuff);
					}
				}
				orig.Invoke(self);
			};
		}
	}
	internal class Quicksilver
	{
		public class Statistics : MonoBehaviour
		{
			public class Sync : INetMessage, ISerializableObject
			{
				private NetworkInstanceId objId;

				private float lastTick;

				public Sync()
				{
				}

				public Sync(NetworkInstanceId objId, float tick)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					this.objId = objId;
					lastTick = tick;
				}

				public 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)
					objId = reader.ReadNetworkId();
					lastTick = reader.ReadSingle();
				}

				public void OnReceived()
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					if (NetworkServer.active)
					{
						return;
					}
					GameObject val = Util.FindNetworkObject(objId);
					if ((Object)(object)val != (Object)null)
					{
						Statistics component = val.GetComponent<Statistics>();
						if ((Object)(object)component != (Object)null)
						{
							component.LastTick = lastTick;
						}
					}
				}

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

			private float _lastTick;

			public float LastTick
			{
				get
				{
					return _lastTick;
				}
				set
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					_lastTick = value;
					if (NetworkServer.active)
					{
						NetMessageExtensions.Send((INetMessage)(object)new Sync(((Component)this).gameObject.GetComponent<NetworkIdentity>().netId, value), (NetworkDestination