Decompiled source of Caeli Imperium v0.9.1

plugins/CaeliImperium.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 BrynzaAPI;
using CaeliImperium;
using CaeliImperium.Components;
using CaeliImperium.Configs;
using CaeliImperium.ItemBehaviours;
using CaeliImperium.Items;
using CaeliImperiumEntityStates;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using HG.Reflection;
using IL.RoR2;
using IL.RoR2.Skills;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.Skills;
using R2API;
using R2API.Networking;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

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

		public static float dotDuration = 5f;

		public int stack;

		public float charge;

		public void Fire()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_001b: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			Ray aimRay = ((BaseState)this).GetAimRay();
			if (((EntityState)this).isAuthority)
			{
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					minSpread = 0f,
					maxSpread = 0f,
					damage = ((EntityState)this).characterBody.damage * Utils.ConvertAmplificationPercentageIntoReductionPercentage(charge, maxDamageMultiplier),
					force = 0f,
					tracerEffectPrefab = CaeliImperiumAssets.fireSnipeSuperTracer,
					hitEffectPrefab = null,
					isCrit = ((BaseState)this).RollCrit(),
					radius = 2f,
					smartCollision = true,
					trajectoryAimAssistMultiplier = FirePistol2.trajectoryAimAssistMultiplier,
					damageType = DamageTypeCombo.GenericSpecial,
					hitCallback = new HitCallback(IrradiateOnHit)
				}.Fire();
			}
			bool IrradiateOnHit(BulletAttack bulletAttack, ref BulletHit hitInfo)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: 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)
				if (Object.op_Implicit((Object)(object)hitInfo.hitHurtBox))
				{
					InflictDotInfo val = default(InflictDotInfo);
					val.attackerObject = ((EntityState)this).gameObject;
					val.victimObject = ((Component)hitInfo.hitHurtBox.healthComponent).gameObject;
					val.totalDamage = ((EntityState)this).characterBody.damage;
					val.damageMultiplier = stack;
					val.duration = dotDuration;
					val.dotIndex = CaeliImperiumContent.Buffs.IrradiatedDotIndex;
					InflictDotInfo val2 = val;
					DotController.InflictDot(ref val2);
				}
				return BulletAttack.DefaultHitCallbackImplementation(bulletAttack, ref hitInfo);
			}
		}
	}
	public class FireSkullGun : BaseState
	{
		public int stack;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			Fire();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void Fire()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Util.PlaySound(FirePistol2.firePistolSoundString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)FirePistol2.muzzleEffectPrefab))
			{
				EffectData val = new EffectData
				{
					origin = ((Ray)(ref aimRay)).origin,
					rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction)
				};
				EffectManager.SpawnEffect(FirePistol2.muzzleEffectPrefab, val, true);
			}
			if (((EntityState)this).isAuthority)
			{
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					minSpread = 0f,
					maxSpread = 0f,
					damage = base.damageStat * (float)stack,
					force = 0f,
					tracerEffectPrefab = FirePistol2.tracerEffectPrefab,
					hitEffectPrefab = FirePistol2.hitEffectPrefab,
					isCrit = ((BaseState)this).RollCrit(),
					radius = 0.1f,
					smartCollision = true,
					trajectoryAimAssistMultiplier = FirePistol2.trajectoryAimAssistMultiplier,
					damageType = DamageTypeCombo.GenericPrimary
				}.Fire();
			}
		}
	}
}
namespace CaeliImperium
{
	public static class CaeliImperiumAssets
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static CollectContentPackProvidersDelegate <>9__14_0;

			internal void <Init>b__14_0(AddContentPackProviderDelegate addContentPackProvider)
			{
				addContentPackProvider.Invoke((IContentPackProvider)(object)new CaeliImperiumContent());
			}
		}

		public static AssetBundle assetBundle;

		public static GameObject stunEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/ImpactStunGrenade");

		public static GameObject childProjectileGhost = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Child/FrolicProjectileGhost.prefab").WaitForCompletion();

		public static GameObject chestModel = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Chest1/mdlChest1.fbx").WaitForCompletion();

		public static EntityStateConfiguration fireSnipeHeavyConfig = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeHeavy.asset").WaitForCompletion();

		public static GameObject fireSnipeSuperTracer = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/TracerRailgunSuper.prefab").WaitForCompletion();

		public static GameObject igniteOnkillExplosion = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/IgniteOnKill/IgniteExplosionVFX.prefab").WaitForCompletion();

		public static GameObject mercMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercMonsterMaster.prefab").WaitForCompletion();

		public static DeployableSlot mercenaryGhostDeployable;

		public static GameObject EquipmentPicker;

		public static GameObject EquipmentPickerSlot;

		public static GameObject SpeedPathPrefab;

		public static GameObject GlobalSpeedPathPrefab;

		public static GameObject SpeedPathEndPrefab;

		public static void Init()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			assetBundle = AssetBundle.LoadFromFileAsync(Path.Combine(Path.GetDirectoryName(CaeliImperiumPlugin.PluginInfo.Location), "assetbundles", "caeliimperiumassets")).assetBundle;
			Material[] array = assetBundle.LoadAllAssets<Material>();
			foreach (Material val in array)
			{
				if (((Object)val.shader).name.StartsWith("StubbedRoR2"))
				{
					string text = ((Object)val.shader).name.Replace("StubbedRoR2", "RoR2") + ".shader";
					Shader val2 = Addressables.LoadAssetAsync<Shader>((object)text).WaitForCompletion();
					if (Object.op_Implicit((Object)(object)val2))
					{
						val.shader = val2;
					}
				}
			}
			EquipmentPicker = assetBundle.LoadAsset<GameObject>("Assets/CaeliImperium/Prefabs/EquipmentPicker.prefab");
			EquipmentPickerSlot = assetBundle.LoadAsset<GameObject>("Assets/CaeliImperium/Prefabs/EquipmentPickerSlot.prefab");
			SpeedPathPrefab = assetBundle.LoadAsset<GameObject>("Assets/CaeliImperium/Prefabs/SpeedPath.prefab");
			GlobalSpeedPathPrefab = assetBundle.LoadAsset<GameObject>("Assets/CaeliImperium/Prefabs/GlobalSpeedPath.prefab");
			SpeedPathEndPrefab = assetBundle.LoadAsset<GameObject>("Assets/CaeliImperium/Effects/ChalkEnd.prefab");
			CaeliImperiumContent.Items.DrawSpeedPath = assetBundle.LoadAsset<CIItemDef>("Assets/CaeliImperium/Items/DrawSpeedPath.asset").RegisterItemDef(DrawSpeedPathEvents.Init);
			CaeliImperiumContent.Items.HealReceivedDamage = assetBundle.LoadAsset<CIItemDef>("Assets/CaeliImperium/Items/HealReceivedDamage.asset").RegisterItemDef(HealReceivedDamageEvents.Init);
			CaeliImperiumContent.Items.InfiniteSecondarySkillCharges = assetBundle.LoadAsset<CIItemDef>("Assets/CaeliImperium/Items/InfiniteSecondarySkillCharges.asset").RegisterItemDef(InfiniteSecondarySkillChargesEvents.Init);
			CaeliImperiumPlugin.expansionDef = assetBundle.LoadAsset<ExpansionDef>("Assets/CaeliImperium/CaeliImperiumExpansion.asset").RegisterExpansionDef<ExpansionDef>((Action<ExpansionDef>)null);
			CaeliImperiumPlugin.expansionDef.disabledIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texUnlockIcon.png").WaitForCompletion();
			object obj = <>c.<>9__14_0;
			if (obj == null)
			{
				CollectContentPackProvidersDelegate val3 = delegate(AddContentPackProviderDelegate addContentPackProvider)
				{
					addContentPackProvider.Invoke((IContentPackProvider)(object)new CaeliImperiumContent());
				};
				<>c.<>9__14_0 = val3;
				obj = (object)val3;
			}
			ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
		}
	}
	public class CaeliImperiumContent : IContentPackProvider
	{
		public static class Items
		{
			public static CIItemDef CritUpgradeOnKill;

			public static CIItemDef ExtraEquipmentSlot;

			public static CIItemDef FireBulletOnPrimarySkill;

			public static CIItemDef PeriodicDamageIncrease;

			public static CIItemDef StunEnemyOnItsAttack;

			public static CIItemDef ChargeAtomicBeamOnSpecialSkill;

			public static CIItemDef CopyNearbyCharactersSkillsOnDeath;

			public static CIItemDef ImproveHealingAndRegen;

			public static CIItemDef SummonMercenary;

			public static CIItemDef ShareDamageToAll;

			public static CIItemDef DuplicateMainSkills;

			public static CIItemDef WoundEnemyOnContiniousHits;

			public static CIItemDef DropHealOrbsOnContiniousHits;

			public static CIItemDef TeleportAroundOpenedChests;

			public static CIItemDef DrawSpeedPath;

			public static CIItemDef HealReceivedDamage;

			public static CIItemDef InfiniteSecondarySkillCharges;

			public static CIItemDef TransferDamageOwnership;
		}

		public static class Buffs
		{
			public static BuffDef IncreaseCritChanceAndDamage;

			public static BuffDef IncreaseDamagePereodically;

			public static BuffDef TaoPunchReady;

			public static BuffDef TaoPunchCooldown;

			public static BuffDef SpeedPathSpeedBonus;

			public static BuffDef IncreaseSecondarySkillDamage;

			public static BuffDef AffixSpeedster;

			public static BuffDef IrradiatedBuff;

			public static DotDef IrradiatedDot;

			public static DotIndex IrradiatedDotIndex;
		}

		public static class Elites
		{
			public static EliteDef HastingElite;
		}

		public static class Equipments
		{
			public static EquipmentDef Necronomicon;

			public static EquipmentDef SpeedsterEquipment;

			public static EquipmentDef DamageAllEnemies;
		}

		[CompilerGenerated]
		private sealed class <FinalizeAsync>d__18 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FinalizeAsyncArgs args;

			public CaeliImperiumContent <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FinalizeAsync>d__18(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GenerateContentPackAsync>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GetContentPackAsyncArgs args;

			public CaeliImperiumContent <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GenerateContentPackAsync>d__19(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				ContentPack.Copy(<>4__this.contentPack, args.output);
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadStaticContentAsync>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoadStaticContentAsyncArgs args;

			public CaeliImperiumContent <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadStaticContentAsync>d__20(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>4__this.contentPack.identifier = <>4__this.identifier;
				<>4__this.contentPack.skillDefs.Add(skills.ToArray());
				<>4__this.contentPack.skillFamilies.Add(skillFamilies.ToArray());
				<>4__this.contentPack.bodyPrefabs.Add(bodies.ToArray());
				<>4__this.contentPack.buffDefs.Add(buffs.ToArray());
				<>4__this.contentPack.projectilePrefabs.Add(projectiles.ToArray());
				<>4__this.contentPack.survivorDefs.Add(survivors.ToArray());
				<>4__this.contentPack.entityStateTypes.Add(states.ToArray());
				<>4__this.contentPack.networkSoundEventDefs.Add(sounds.ToArray());
				<>4__this.contentPack.networkedObjectPrefabs.Add(networkPrefabs.ToArray());
				<>4__this.contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
				<>4__this.contentPack.masterPrefabs.Add(masters.ToArray());
				<>4__this.contentPack.itemDefs.Add(items.ToArray());
				<>4__this.contentPack.equipmentDefs.Add(equipments.ToArray());
				<>4__this.contentPack.eliteDefs.Add(elites.ToArray());
				<>4__this.contentPack.expansionDefs.Add(expansions.ToArray());
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal ContentPack contentPack = new ContentPack();

		public static List<GameObject> bodies = new List<GameObject>();

		public static List<BuffDef> buffs = new List<BuffDef>();

		public static List<SkillDef> skills = new List<SkillDef>();

		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<GameObject> projectiles = new List<GameObject>();

		public static List<GameObject> networkPrefabs = new List<GameObject>();

		public static List<SurvivorDef> survivors = new List<SurvivorDef>();

		public static List<Type> states = new List<Type>();

		public static List<NetworkSoundEventDef> sounds = new List<NetworkSoundEventDef>();

		public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

		public static List<GameObject> masters = new List<GameObject>();

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

		public static List<EquipmentDef> equipments = new List<EquipmentDef>();

		public static List<EliteDef> elites = new List<EliteDef>();

		public static List<ExpansionDef> expansions = new List<ExpansionDef>();

		public string identifier => "com.brynzananas.caeliimperium.ContentProvider";

		[IteratorStateMachine(typeof(<FinalizeAsync>d__18))]
		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FinalizeAsync>d__18(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__19))]
		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GenerateContentPackAsync>d__19(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__20))]
		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadStaticContentAsync>d__20(0)
			{
				<>4__this = this,
				args = args
			};
		}
	}
	[Serializable]
	[BepInPlugin("com.brynzananas.caeliimperium", "Caeli Imperium", "0.9.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class CaeliImperiumPlugin : BaseUnityPlugin
	{
		public const string ModGuid = "com.brynzananas.caeliimperium";

		public const string ModName = "Caeli Imperium";

		public const string ModVer = "0.9.0";

		public const string ModPrefix = "CI";

		public static bool emotesEnabled;

		public static bool riskOfOptionsEnabled;

		public static ExpansionDef expansionDef;

		public static Action OnPluginDestroyed;

		public static PluginInfo PluginInfo { get; private set; }

		public static ConfigFile configFile { get; private set; }

		public static ManualLogSource Log { get; private set; }

		public void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			PluginInfo = ((BaseUnityPlugin)this).Info;
			configFile = ((BaseUnityPlugin)this).Config;
			riskOfOptionsEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			CaeliImperiumAssets.Init();
			if (riskOfOptionsEnabled)
			{
				ModCompatabilities.RiskOfOptionsCompatability.Init();
			}
			DrawSpeedPathConfigs.Init();
			HealReceivedDamageConfigs.Init();
			InfiniteSecondarySkillChargesConfigs.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Language.Init));
		}

		public void OnDestroy()
		{
			RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(Language.Init));
			OnPluginDestroyed?.Invoke();
		}
	}
	public static class Events
	{
		public static List<DeadBodyComponent> deadBodyComponents = new List<DeadBodyComponent>();

		public static float irradiatedRadius = 12f;

		private static bool TaoRegistered;

		public static void CritUpgradeOnKillEvents(ItemDef itemDef)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Events_GetStatCoefficients);
			static void Events_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
			{
				int num = (Object.op_Implicit((Object)(object)sender) ? sender.GetBuffCount(CaeliImperiumContent.Buffs.IncreaseCritChanceAndDamage) : 0);
				args.critAdd += (float)num * 5f;
				args.critDamageMultAdd += (float)num * 0.05f;
			}
			void GlobalEventManager_onCharacterDeathGlobal(DamageReport obj)
			{
				if (NetworkServer.active)
				{
					CharacterBody attackerBody = obj.attackerBody;
					if (Object.op_Implicit((Object)(object)attackerBody) && !((Object)(object)attackerBody == (Object)null) && !((Object)(object)attackerBody.inventory == (Object)null))
					{
						int itemCount = attackerBody.inventory.GetItemCount(itemDef);
						if (itemCount > 0)
						{
							int num2 = Utils.SuperRoll((float)itemCount * 5f);
							for (int i = 0; i < num2; i++)
							{
								attackerBody.AddBuff(CaeliImperiumContent.Buffs.IncreaseCritChanceAndDamage);
							}
						}
					}
				}
			}
		}

		public static void ExtraEquipmentSlotEvents(ItemDef itemDef)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			EquipmentSlot.MyFixedUpdate += new Manipulator(EquipmentSlot_MyFixedUpdate);
			void EquipmentSlot_MyFixedUpdate(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Expected O, but got Unknown
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				ILLabel iLLabel = null;
				int count = il.Body.Variables.Count;
				il.Body.Variables.Add(new VariableDefinition(il.Import(typeof(bool))));
				int num2 = default(int);
				int num = default(int);
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[7]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)Reflection.GetPropertyGetter(typeof(EquipmentSlot), "characterBody")),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(CharacterBody), "isEquipmentActivationAllowed")),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num2),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchAnd(x),
					(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel)
				}))
				{
					val.Emit(OpCodes.Ldarg_0);
					val.EmitDelegate<Func<EquipmentSlot, bool>>((Func<EquipmentSlot, bool>)OpenPicker);
					val.Emit(OpCodes.Brtrue_S, (object)iLLabel);
				}
				else
				{
					Debug.LogError((object)(((object)il.Method)?.ToString() + "IL Hook failed"));
				}
			}
			void Events_OnInventoryChangedAfter(CharacterBody characterBody)
			{
				if (Object.op_Implicit((Object)(object)characterBody.inventory) && Object.op_Implicit((Object)(object)characterBody.master) && characterBody.inventory.GetItemCount(itemDef) > 0)
				{
					ExtraEquipmentSlotBehaviour orAddComponent = Extensions.GetOrAddComponent<ExtraEquipmentSlotBehaviour>(characterBody.masterObject);
				}
			}
			bool OpenPicker(EquipmentSlot equipmentSlot)
			{
				Inventory inventory = equipmentSlot.inventory;
				if (Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCount(itemDef) > 0)
				{
					EquipmentPicker equipmentPicker = ExtraEquipmentSlotBehaviour.equipmentPicker;
					if (Object.op_Implicit((Object)(object)equipmentPicker) && !((Component)equipmentPicker).gameObject.activeSelf)
					{
						((Component)equipmentPicker).gameObject.SetActive(true);
						return true;
					}
					bool blockEquipmentUse = equipmentPicker.blockEquipmentUse;
					((Component)equipmentPicker).gameObject.SetActive(false);
					return blockEquipmentUse;
				}
				return false;
			}
		}

		public static void FireBulletOnPrimarySkillEvents(ItemDef itemDef)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCount(itemDef) : 0);
				obj.AddItemBehavior<FireBulletOnPrimarySkillBehaviour>(num);
			}
		}

		public static void PeriodicDamageIncreaseEvents(ItemDef itemDef)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Events_GetStatCoefficients);
			static void Events_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
			{
				int num = (Object.op_Implicit((Object)(object)sender) ? sender.GetBuffCount(CaeliImperiumContent.Buffs.IncreaseDamagePereodically) : 0);
				args.damageMultAdd += (float)(num / 2);
			}
			void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				int num2 = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCount(itemDef) : 0);
				obj.AddItemBehavior<PeriodicDamageIncreaseBehaviour>(num2);
			}
		}

		public static void StunEnemyOnItsAttackEvents(ItemDef itemDef)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			SkillDef.OnExecute += new hook_OnExecute(SkillDef_OnExecute);
			void SkillDef_OnExecute(orig_OnExecute orig, SkillDef self, GenericSkill skillSlot)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Expected O, but got Unknown
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Expected O, but got Unknown
				int num = Util.GetItemCountGlobal(itemDef.itemIndex, true, true) - (Object.op_Implicit((Object)(object)skillSlot.characterBody.teamComponent) ? Util.GetItemCountForTeam(skillSlot.characterBody.teamComponent.teamIndex, itemDef.itemIndex, true, true) : 0);
				if (num <= 0)
				{
					orig.Invoke(self, skillSlot);
				}
				else if (!Util.CheckRoll(Utils.ConvertAmplificationPercentageIntoReductionPercentage(num * 15, 50f), 0f, (CharacterMaster)null))
				{
					orig.Invoke(self, skillSlot);
				}
				else
				{
					EffectData val = new EffectData
					{
						origin = skillSlot.characterBody.corePosition
					};
					EffectManager.SpawnEffect(CaeliImperiumAssets.stunEffect, val, true);
					if (Object.op_Implicit((Object)(object)skillSlot.stateMachine))
					{
						StunState val2 = new StunState();
						val2.stunDuration = 1f;
						skillSlot.stateMachine.SetInterruptState((EntityState)(object)val2, (InterruptPriority)5);
					}
				}
			}
		}

		public static void NecronomiconEvents(EquipmentDef equip)
		{
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
			Hooks.equipmentActions.Add(equip, FireNecronomicon);
			static bool FireNecronomicon(EquipmentSlot equipmentSlot, EquipmentDef equipmentDef)
			{
				int i = 0;
				while (deadBodyComponents.Count > 0)
				{
					for (i = 0; i < deadBodyComponents.Count; i++)
					{
						DeadBodyComponent deadBodyComponent = deadBodyComponents[i];
						if ((Object)(object)deadBodyComponent != (Object)null)
						{
							deadBodyComponent.Revive(equipmentSlot.characterBody, destroy: true);
							i++;
						}
						else
						{
							deadBodyComponents.Remove(deadBodyComponent);
						}
					}
				}
				if (i > 0)
				{
					return true;
				}
				return false;
			}
			static void GlobalEventManager_onCharacterDeathGlobal(DamageReport obj)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: 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
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody victimBody = obj.victimBody;
				if (Object.op_Implicit((Object)(object)victimBody))
				{
					GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(victimBody.bodyIndex);
					GameObject masterPrefab = MasterCatalog.GetMasterPrefab(victimBody.master.masterIndex);
					if (!((Object)(object)masterPrefab == (Object)null))
					{
						GameObject val = new GameObject("DeadBody(" + BodyCatalog.GetBodyName(victimBody.bodyIndex) + ")");
						DeadBodyComponent deadBodyComponent2 = val.AddComponent<DeadBodyComponent>();
						deadBodyComponent2.bodyPrefab = bodyPrefab;
						deadBodyComponent2.bodyName = ((Object)bodyPrefab).name;
						deadBodyComponent2.inventory = victimBody.inventory;
						deadBodyComponent2.masterPrefab = masterPrefab;
						val.transform.position = victimBody.transform.position;
						val.transform.rotation = victimBody.transform.rotation;
					}
				}
			}
		}

		public static void DamageAllEnemiesEvents(EquipmentDef equip)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChanged;
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			Hooks.equipmentActions.Add(equip, FireDamageAllEnemies);
			void Events_OnInventoryChanged(CharacterBody obj)
			{
				int equipmentCount = obj.GetEquipmentCount(equip);
				obj.AddItemBehavior<PeriodicDamageIncreaseBehaviour>(equipmentCount);
			}
			static bool FireDamageAllEnemies(EquipmentSlot equipmentSlot, EquipmentDef equipmentDef)
			{
				DamageAllEnemiesBehaviour component = ((Component)equipmentSlot).GetComponent<DamageAllEnemiesBehaviour>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return false;
				}
				component.DamageAll();
				return true;
			}
			static void GlobalEventManager_onServerDamageDealt(DamageReport obj)
			{
				DamageAllEnemiesBehaviour damageAllEnemiesBehaviour = (Object.op_Implicit((Object)(object)obj.attacker) ? obj.attacker.GetComponent<DamageAllEnemiesBehaviour>() : null);
				DamageAllEnemiesBehaviour damageAllEnemiesBehaviour2 = (Object.op_Implicit((Object)(object)obj.victim) ? ((Component)obj.victim).GetComponent<DamageAllEnemiesBehaviour>() : null);
				if (Object.op_Implicit((Object)(object)damageAllEnemiesBehaviour))
				{
					damageAllEnemiesBehaviour.outcomingDamage += obj.damageDealt;
				}
				if (Object.op_Implicit((Object)(object)damageAllEnemiesBehaviour2))
				{
					damageAllEnemiesBehaviour2.receivedDamage += obj.damageDealt;
				}
			}
		}

		public static void ChargeAtomicBeamOnSpecialSkillEvents(ItemDef item)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCount(item) : 0);
				obj.AddItemBehavior<ChargeAtomicBeamOnSpecialSkillBehaviour>(num);
			}
		}

		public static void CopyNearbyCharactersSkillsOnDeathEvents(ItemDef item)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
			void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCount(item) : 0);
				obj.AddItemBehavior<CopyNearbyCharactersSkillsOnDeathBehaviour>(num);
			}
			void GlobalEventManager_onCharacterDeathGlobal(DamageReport obj)
			{
				CharacterBody attackerBody = obj.attackerBody;
				CharacterBody victimBody = obj.victimBody;
				if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && attackerBody.inventory.GetItemCount(item) > 0 && Object.op_Implicit((Object)(object)victimBody.skillLocator))
				{
					CopyNearbyCharactersSkillsOnDeathBehaviour geneModificationComponent = ((Component)attackerBody).GetComponent<CopyNearbyCharactersSkillsOnDeathBehaviour>();
					if ((Object)(object)geneModificationComponent != (Object)null)
					{
						GenericSkill[] allSkills = victimBody.skillLocator.allSkills;
						foreach (GenericSkill val in allSkills)
						{
							GenericSkill genericSkill1 = Utils.CopyGenericSkill(val, attackerBody, "Sewed");
							if ((Object)(object)genericSkill1 != (Object)null)
							{
								if (Object.op_Implicit((Object)(object)victimBody.skillLocator.primary) && (Object)(object)val == (Object)(object)victimBody.skillLocator.primary)
								{
									AddSkill(1);
									if (Object.op_Implicit((Object)(object)attackerBody.skillLocator) && Object.op_Implicit((Object)(object)attackerBody.skillLocator.primary))
									{
										Extensions.LinkSkill(genericSkill1, attackerBody.skillLocator.primary);
									}
								}
								if (Object.op_Implicit((Object)(object)victimBody.skillLocator.secondary) && (Object)(object)val == (Object)(object)victimBody.skillLocator.secondary)
								{
									AddSkill(2);
									if (Object.op_Implicit((Object)(object)attackerBody.skillLocator) && Object.op_Implicit((Object)(object)attackerBody.skillLocator.secondary))
									{
										Extensions.LinkSkill(genericSkill1, attackerBody.skillLocator.secondary);
									}
								}
								if (Object.op_Implicit((Object)(object)victimBody.skillLocator.utility) && (Object)(object)val == (Object)(object)victimBody.skillLocator.utility)
								{
									AddSkill(3);
									if (Object.op_Implicit((Object)(object)attackerBody.skillLocator) && Object.op_Implicit((Object)(object)attackerBody.skillLocator.utility))
									{
										Extensions.LinkSkill(genericSkill1, attackerBody.skillLocator.utility);
									}
								}
								if (Object.op_Implicit((Object)(object)victimBody.skillLocator.special) && (Object)(object)val == (Object)(object)victimBody.skillLocator.special)
								{
									AddSkill(4);
									if (Object.op_Implicit((Object)(object)attackerBody.skillLocator) && Object.op_Implicit((Object)(object)attackerBody.skillLocator.special))
									{
										Extensions.LinkSkill(genericSkill1, attackerBody.skillLocator.special);
									}
								}
								geneModificationComponent.skillList.Add(genericSkill1);
							}
							void AddSkill(int id)
							{
								if (geneModificationComponent.keyValuePairs.ContainsKey(id))
								{
									geneModificationComponent.keyValuePairs[id].Add(genericSkill1);
								}
								else
								{
									List<GenericSkill> value = new List<GenericSkill> { genericSkill1 };
									geneModificationComponent.keyValuePairs.Add(id, value);
								}
							}
						}
					}
				}
			}
		}

		public static void ImproveHealingAndRegenEvents(ItemDef item)
		{
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			void GlobalEventManager_onServerDamageDealt(DamageReport obj)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				int num = ((Object.op_Implicit((Object)(object)obj.victimBody) && Object.op_Implicit((Object)(object)obj.victimBody.inventory)) ? obj.victimBody.inventory.GetItemCount(item) : 0);
				if (num > 0 && Object.op_Implicit((Object)(object)obj.victimBody.healthComponent))
				{
					obj.victimBody.healthComponent.Heal(obj.damageDealt * 0.1f * (float)num, default(ProcChainMask), true);
				}
			}
		}

		public static void IrradiatedDotBehaviour(DotController self, DotStack dotStack)
		{
		}

		public static void IrradiatedDotEvaluation(DotController self, PendingDamage pendingDamage)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			BlastAttack val = new BlastAttack
			{
				attacker = pendingDamage.attackerObject,
				inflictor = pendingDamage.attackerObject,
				teamIndex = TeamComponent.GetObjectTeam(pendingDamage.attackerObject),
				baseDamage = pendingDamage.totalDamage,
				baseForce = 0f,
				position = self.victimBody.corePosition,
				radius = irradiatedRadius,
				damageColorIndex = (DamageColorIndex)10,
				falloffModel = (FalloffModel)0
			};
			val.Fire();
			EffectData val2 = new EffectData
			{
				origin = val.position,
				scale = val.radius
			};
			EffectManager.SpawnEffect(CaeliImperiumAssets.igniteOnkillExplosion, val2, true);
		}

		public static void SummonMercenaryEvents(ItemDef item)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				if (NetworkServer.instance != null)
				{
					int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCount(item) : 0);
					obj.AddItemBehavior<SummonMercenaryBehaviour>(num);
				}
			}
		}

		public static void TransferDamageOwnershipEvents(ItemDef item)
		{
			Hooks.OnTakeDamageProcess += Events_OnTakeDamageProcessBefore;
			void Events_OnTakeDamageProcessBefore(HealthComponent arg1, DamageInfo arg2, CharacterBody attackerBody, ref float damage)
			{
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.master) && Object.op_Implicit((Object)(object)attackerBody.master.minionOwnership) && Object.op_Implicit((Object)(object)attackerBody.master.minionOwnership.ownerMaster) && Object.op_Implicit((Object)(object)attackerBody.inventory) && attackerBody.inventory.GetItemCount(item) > 0)
				{
					arg2.attacker = attackerBody.master.minionOwnership.ownerMaster.GetBodyObject();
					arg2.damageColorIndex = (DamageColorIndex)3;
				}
			}
		}

		public static void DuplicateMainSkillsEvents(ItemDef item)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCount(item) : 0);
				obj.AddItemBehavior<DuplicateMainSkillsBehaviour>(num);
			}
		}

		public static void ShareDamageToAllEvents(ItemDef item)
		{
		}

		public static void TaoEvents(ItemDef itemDef)
		{
			if (!TaoRegistered)
			{
				TaoRegistered = true;
				Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
				GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			}
			static void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				int num = (Object.op_Implicit((Object)(object)obj.inventory) ? (obj.inventory.GetItemCount((ItemDef)(object)CaeliImperiumContent.Items.WoundEnemyOnContiniousHits) + obj.inventory.GetItemCount((ItemDef)(object)CaeliImperiumContent.Items.DropHealOrbsOnContiniousHits)) : 0);
				obj.AddItemBehavior<TaoArtifactsComponent>(num);
			}
			static void GlobalEventManager_onServerDamageDealt(DamageReport obj)
			{
				TaoArtifactsComponent taoArtifactsComponent = ((Object.op_Implicit((Object)(object)obj.attackerBody) && Object.op_Implicit((Object)(object)obj.attackerBody.inventory) && obj.attackerBody.inventory.GetItemCount((ItemDef)(object)CaeliImperiumContent.Items.WoundEnemyOnContiniousHits) + obj.attackerBody.inventory.GetItemCount((ItemDef)(object)CaeliImperiumContent.Items.DropHealOrbsOnContiniousHits) > 0) ? obj.attacker.GetComponent<TaoArtifactsComponent>() : null);
				if ((Object)(object)taoArtifactsComponent != (Object)null)
				{
					taoArtifactsComponent.RegisterHit(obj);
				}
			}
		}

		public static void TeleportAroundOpenedChestsEvents(ItemDef item)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChangedAfter;
			Hooks.OnPurchaseInteractionEnable += Events_OnPurchaseInteractionEnableAfter;
			void Events_OnInventoryChangedAfter(CharacterBody obj)
			{
				int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCountEffective(item) : 0);
				obj.AddItemBehavior<TeleportAroundOpenedChestsBehaviour>(num);
			}
			static void Events_OnPurchaseInteractionEnableAfter(PurchaseInteraction obj)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected O, but got Unknown
				GameObject val = new GameObject("Wormhole");
				val.transform.SetParent(((Component)obj).transform, false);
				SphereCollider val2 = val.AddComponent<SphereCollider>();
				val2.radius = 1f;
				val.layer = LayerIndex.noCollision.intVal;
				WormholeComponent wormholeComponent = val.AddComponent<WormholeComponent>();
			}
		}

		public static void HastingEvents(EliteDef eliteDef)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Events_GetStatCoefficients);
			static void Events_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
			{
				if (sender.HasBuff(CaeliImperiumContent.Buffs.AffixSpeedster))
				{
					args.moveSpeedMultAdd += 1f;
					args.primaryCooldownMultAdd -= 0.5f;
					args.secondaryCooldownMultAdd -= 0.5f;
					args.utilityCooldownMultAdd -= 0.5f;
					args.specialCooldownMultAdd -= 0.5f;
					args.attackSpeedMultAdd += 1f;
				}
			}
		}
	}
	public static class Hooks
	{
		public delegate void HealthComponent_TakeDamageProcess_Delegate(HealthComponent healthComponent, DamageInfo damageInfo, CharacterBody characterBody, ref float damage);

		public delegate bool PerformEquipmentAction(EquipmentSlot equipmentSlot, EquipmentDef equipmentDef);

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnBuffFinalStackLost <0>__CharacterBody_OnBuffFinalStackLost;

			public static hook_OnBuffFirstStackGained <1>__CharacterBody_OnBuffFirstStackGained;

			public static hook_RecalculateMaxStock <2>__GenericSkill_RecalculateMaxStock;

			public static hook_Init <3>__CombatDirector_Init;

			public static hook_OnEnable <4>__PurchaseInteraction_OnEnable;

			public static Manipulator <5>__HealthComponent_TakeDamageProcess;

			public static hook_PerformEquipmentAction <6>__EquipmentSlot_PerformEquipmentAction;

			public static hook_OnInventoryChanged <7>__CharacterBody_OnInventoryChanged;
		}

		private static int _OnBuffFinalStackLostHookAdded;

		private static int _OnBuffFirstStackGainedHookAdded;

		private static int _OnRecalculateMaxStockHookAdded;

		private static int _OnCombatDirectorInitHookAdded;

		private static int _OnPurchaseInteractionEnableHookAdded;

		private static int _OnTakeDamageProcessHookAdded;

		private static FieldReference ThatFuckingField;

		private static TypeDefinition ThatFuckingStructThatIHate;

		private static bool _equipmentActionsAdded;

		private static Dictionary<EquipmentDef, PerformEquipmentAction> _equipmentActions = new Dictionary<EquipmentDef, PerformEquipmentAction>();

		private static int _OnInventoryChangedHookAdded;

		public static Dictionary<EquipmentDef, PerformEquipmentAction> equipmentActions
		{
			get
			{
				return _equipmentActions;
			}
			set
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Expected O, but got Unknown
				if (!_equipmentActionsAdded)
				{
					object obj = <>O.<6>__EquipmentSlot_PerformEquipmentAction;
					if (obj == null)
					{
						hook_PerformEquipmentAction val = EquipmentSlot_PerformEquipmentAction;
						<>O.<6>__EquipmentSlot_PerformEquipmentAction = val;
						obj = (object)val;
					}
					EquipmentSlot.PerformEquipmentAction += (hook_PerformEquipmentAction)obj;
					_equipmentActionsAdded = true;
				}
				_equipmentActions = value;
			}
		}

		private static event Action<CharacterBody, BuffDef> _OnBuffFinalStackLost;

		public static event Action<CharacterBody, BuffDef> OnBuffFinalStackLost
		{
			add
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnBuffFinalStackLostHookAdded == 0)
				{
					object obj = <>O.<0>__CharacterBody_OnBuffFinalStackLost;
					if (obj == null)
					{
						hook_OnBuffFinalStackLost val = CharacterBody_OnBuffFinalStackLost;
						<>O.<0>__CharacterBody_OnBuffFinalStackLost = val;
						obj = (object)val;
					}
					CharacterBody.OnBuffFinalStackLost += (hook_OnBuffFinalStackLost)obj;
				}
				_OnBuffFinalStackLost += value;
				_OnBuffFinalStackLostHookAdded++;
			}
			remove
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnBuffFinalStackLostHookAdded == 1)
				{
					object obj = <>O.<0>__CharacterBody_OnBuffFinalStackLost;
					if (obj == null)
					{
						hook_OnBuffFinalStackLost val = CharacterBody_OnBuffFinalStackLost;
						<>O.<0>__CharacterBody_OnBuffFinalStackLost = val;
						obj = (object)val;
					}
					CharacterBody.OnBuffFinalStackLost -= (hook_OnBuffFinalStackLost)obj;
				}
				_OnBuffFinalStackLost -= value;
				_OnBuffFinalStackLostHookAdded--;
			}
		}

		private static event Action<CharacterBody, BuffDef> _OnBuffFirstStackGained;

		public static event Action<CharacterBody, BuffDef> OnBuffFirstStackGained
		{
			add
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnBuffFirstStackGainedHookAdded == 0)
				{
					object obj = <>O.<1>__CharacterBody_OnBuffFirstStackGained;
					if (obj == null)
					{
						hook_OnBuffFirstStackGained val = CharacterBody_OnBuffFirstStackGained;
						<>O.<1>__CharacterBody_OnBuffFirstStackGained = val;
						obj = (object)val;
					}
					CharacterBody.OnBuffFirstStackGained += (hook_OnBuffFirstStackGained)obj;
				}
				_OnBuffFirstStackGained += value;
				_OnBuffFirstStackGainedHookAdded++;
			}
			remove
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnBuffFirstStackGainedHookAdded == 1)
				{
					object obj = <>O.<1>__CharacterBody_OnBuffFirstStackGained;
					if (obj == null)
					{
						hook_OnBuffFirstStackGained val = CharacterBody_OnBuffFirstStackGained;
						<>O.<1>__CharacterBody_OnBuffFirstStackGained = val;
						obj = (object)val;
					}
					CharacterBody.OnBuffFirstStackGained -= (hook_OnBuffFirstStackGained)obj;
				}
				_OnBuffFirstStackGained -= value;
				_OnBuffFirstStackGainedHookAdded--;
			}
		}

		private static event Action<GenericSkill> _OnRecalculateMaxStock;

		public static event Action<GenericSkill> OnRecalculateMaxStock
		{
			add
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnRecalculateMaxStockHookAdded == 0)
				{
					object obj = <>O.<2>__GenericSkill_RecalculateMaxStock;
					if (obj == null)
					{
						hook_RecalculateMaxStock val = GenericSkill_RecalculateMaxStock;
						<>O.<2>__GenericSkill_RecalculateMaxStock = val;
						obj = (object)val;
					}
					GenericSkill.RecalculateMaxStock += (hook_RecalculateMaxStock)obj;
				}
				_OnRecalculateMaxStock += value;
				_OnRecalculateMaxStockHookAdded++;
			}
			remove
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnRecalculateMaxStockHookAdded == 1)
				{
					object obj = <>O.<2>__GenericSkill_RecalculateMaxStock;
					if (obj == null)
					{
						hook_RecalculateMaxStock val = GenericSkill_RecalculateMaxStock;
						<>O.<2>__GenericSkill_RecalculateMaxStock = val;
						obj = (object)val;
					}
					GenericSkill.RecalculateMaxStock -= (hook_RecalculateMaxStock)obj;
				}
				_OnRecalculateMaxStock -= value;
				_OnRecalculateMaxStockHookAdded--;
			}
		}

		private static event Action _OnCombatDirectorInit;

		public static event Action OnCombatDirectorInit
		{
			add
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnCombatDirectorInitHookAdded == 0)
				{
					object obj = <>O.<3>__CombatDirector_Init;
					if (obj == null)
					{
						hook_Init val = CombatDirector_Init;
						<>O.<3>__CombatDirector_Init = val;
						obj = (object)val;
					}
					CombatDirector.Init += (hook_Init)obj;
				}
				_OnCombatDirectorInit += value;
				_OnRecalculateMaxStockHookAdded++;
			}
			remove
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnCombatDirectorInitHookAdded == 1)
				{
					object obj = <>O.<3>__CombatDirector_Init;
					if (obj == null)
					{
						hook_Init val = CombatDirector_Init;
						<>O.<3>__CombatDirector_Init = val;
						obj = (object)val;
					}
					CombatDirector.Init -= (hook_Init)obj;
				}
				_OnCombatDirectorInit -= value;
				_OnRecalculateMaxStockHookAdded--;
			}
		}

		private static event Action<PurchaseInteraction> _OnPurchaseInteractionEnable;

		public static event Action<PurchaseInteraction> OnPurchaseInteractionEnable
		{
			add
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnPurchaseInteractionEnableHookAdded == 0)
				{
					object obj = <>O.<4>__PurchaseInteraction_OnEnable;
					if (obj == null)
					{
						hook_OnEnable val = PurchaseInteraction_OnEnable;
						<>O.<4>__PurchaseInteraction_OnEnable = val;
						obj = (object)val;
					}
					PurchaseInteraction.OnEnable += (hook_OnEnable)obj;
				}
				_OnPurchaseInteractionEnable += value;
				_OnPurchaseInteractionEnableHookAdded++;
			}
			remove
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnPurchaseInteractionEnableHookAdded == 1)
				{
					object obj = <>O.<4>__PurchaseInteraction_OnEnable;
					if (obj == null)
					{
						hook_OnEnable val = PurchaseInteraction_OnEnable;
						<>O.<4>__PurchaseInteraction_OnEnable = val;
						obj = (object)val;
					}
					PurchaseInteraction.OnEnable -= (hook_OnEnable)obj;
				}
				_OnPurchaseInteractionEnable -= value;
				_OnPurchaseInteractionEnableHookAdded--;
			}
		}

		private static event HealthComponent_TakeDamageProcess_Delegate _OnTakeDamageProcess;

		public static event HealthComponent_TakeDamageProcess_Delegate OnTakeDamageProcess
		{
			add
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnTakeDamageProcessHookAdded == 0)
				{
					object obj = <>O.<5>__HealthComponent_TakeDamageProcess;
					if (obj == null)
					{
						Manipulator val = HealthComponent_TakeDamageProcess;
						<>O.<5>__HealthComponent_TakeDamageProcess = val;
						obj = (object)val;
					}
					HealthComponent.TakeDamageProcess += (Manipulator)obj;
				}
				_OnTakeDamageProcess += value;
				_OnTakeDamageProcessHookAdded++;
			}
			remove
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnTakeDamageProcessHookAdded == 1)
				{
					object obj = <>O.<5>__HealthComponent_TakeDamageProcess;
					if (obj == null)
					{
						Manipulator val = HealthComponent_TakeDamageProcess;
						<>O.<5>__HealthComponent_TakeDamageProcess = val;
						obj = (object)val;
					}
					HealthComponent.TakeDamageProcess -= (Manipulator)obj;
				}
				_OnTakeDamageProcess -= value;
				_OnTakeDamageProcessHookAdded--;
			}
		}

		private static event Action<CharacterBody> _OnInventoryChanged;

		public static event Action<CharacterBody> OnInventoryChanged
		{
			add
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnInventoryChangedHookAdded == 0)
				{
					object obj = <>O.<7>__CharacterBody_OnInventoryChanged;
					if (obj == null)
					{
						hook_OnInventoryChanged val = CharacterBody_OnInventoryChanged;
						<>O.<7>__CharacterBody_OnInventoryChanged = val;
						obj = (object)val;
					}
					CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)obj;
				}
				_OnInventoryChanged += value;
				_OnInventoryChangedHookAdded++;
			}
			remove
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				if (_OnInventoryChangedHookAdded == 1)
				{
					object obj = <>O.<7>__CharacterBody_OnInventoryChanged;
					if (obj == null)
					{
						hook_OnInventoryChanged val = CharacterBody_OnInventoryChanged;
						<>O.<7>__CharacterBody_OnInventoryChanged = val;
						obj = (object)val;
					}
					CharacterBody.OnInventoryChanged -= (hook_OnInventoryChanged)obj;
				}
				_OnInventoryChanged -= value;
				_OnInventoryChangedHookAdded--;
			}
		}

		private static void CharacterBody_OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			try
			{
				Hooks._OnBuffFinalStackLost?.Invoke(self, buffDef);
			}
			catch (Exception)
			{
			}
		}

		private static void CharacterBody_OnBuffFirstStackGained(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			try
			{
				Hooks._OnBuffFirstStackGained?.Invoke(self, buffDef);
			}
			catch (Exception)
			{
			}
		}

		private static void GenericSkill_RecalculateMaxStock(orig_RecalculateMaxStock orig, GenericSkill self)
		{
			orig.Invoke(self);
			try
			{
				Hooks._OnRecalculateMaxStock?.Invoke(self);
			}
			catch (Exception)
			{
			}
		}

		private static void CombatDirector_Init(orig_Init orig)
		{
			orig.Invoke();
			try
			{
				Hooks._OnCombatDirectorInit?.Invoke();
			}
			catch (Exception)
			{
			}
		}

		private static void PurchaseInteraction_OnEnable(orig_OnEnable orig, PurchaseInteraction self)
		{
			orig.Invoke(self);
			try
			{
				Hooks._OnPurchaseInteractionEnable?.Invoke(self);
			}
			catch (Exception)
			{
			}
		}

		private static void HealthComponent_TakeDamageProcess(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int locid = 10;
			int num = default(int);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref ThatFuckingField),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(CharacterBody), "master")),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
			}))
			{
				ThatFuckingStructThatIHate = ((MemberReference)ThatFuckingField).DeclaringType.Resolve();
				FieldReference val2 = default(FieldReference);
				if (val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "damage"),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locid)
				}))
				{
					val.Emit(OpCodes.Ldarg_0);
					val.Emit(OpCodes.Ldloc_0);
					val.Emit(OpCodes.Ldfld, (FieldReference)(object)ThatFuckingStructThatIHate.Fields[2]);
					val.Emit(OpCodes.Ldloc_0);
					val.Emit(OpCodes.Ldfld, (FieldReference)(object)ThatFuckingStructThatIHate.Fields[1]);
					val.Emit(OpCodes.Ldloc, locid);
					val.EmitDelegate<Func<HealthComponent, DamageInfo, CharacterBody, float, float>>((Func<HealthComponent, DamageInfo, CharacterBody, float, float>)Event);
					val.Emit(OpCodes.Stloc, locid);
				}
				else
				{
					CaeliImperiumPlugin.Log.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 2 failed!"));
				}
			}
			else
			{
				CaeliImperiumPlugin.Log.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 1 failed!"));
			}
			static float Event(HealthComponent healthComponent, DamageInfo damageInfo, CharacterBody attackerBody, float damage)
			{
				try
				{
					Hooks._OnTakeDamageProcess?.Invoke(healthComponent, damageInfo, attackerBody, ref damage);
				}
				catch (Exception)
				{
				}
				return damage;
			}
		}

		private static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
		{
			try
			{
				if (equipmentActions.ContainsKey(equipmentDef) && equipmentActions[equipmentDef] != null)
				{
					if (equipmentActions[equipmentDef](self, equipmentDef))
					{
						return true;
					}
					return false;
				}
			}
			catch (Exception)
			{
			}
			return orig.Invoke(self, equipmentDef);
		}

		private static void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			try
			{
				Hooks._OnInventoryChanged?.Invoke(self);
			}
			catch (Exception)
			{
			}
		}
	}
	public static class Language
	{
		public const string damagePrefix = "<style=cIsDamage>";

		public const string keywordPrefix = "<style=cKeywordName>";

		public const string subPrefix = "<style=cSub>";

		public const string stackPrefix = "<style=cStack>";

		public const string deathPrefix = "<style=cDeath>";

		public const string utilityPrefix = "<style=cIsUtility>";

		public const string healingPrefix = "<style=cIsHealing>";

		public const string endPrefix = "</style>";

		public static void Init()
		{
			AddLanguageToken(CaeliImperiumPlugin.expansionDef.nameToken, "Caeli Imperium");
			AddLanguageToken(CaeliImperiumPlugin.expansionDef.descriptionToken, "Adds content from the 'Caeli Imperium' expansion to the game.");
			AddLanguageToken(CaeliImperiumPlugin.expansionDef.descriptionToken, "Добавляет в игру контент из дополнения «Caeli Imperium».", "ru");
			InitHealReceivedDamage();
			InitDrawSpeedPath();
			InitInfiniteSecondarySkillCharges();
		}

		public static void InitHealReceivedDamage()
		{
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.HealReceivedDamage).nameToken, "Emergency Medical Treatment");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.HealReceivedDamage).nameToken, "Неотложенная Медецинская Помощь", "ru");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.HealReceivedDamage).pickupToken, "Heal received damage over the time course.");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.HealReceivedDamage).pickupToken, "Исцелите полученный урон на протяжении некоторого времени.", "ru");
			float healReceivedDamageTime = HealReceivedDamageEvents.HealReceivedDamageTime;
			string text = ((healReceivedDamageTime == 1f) ? "second" : "seconds");
			string secondsRuString = GetSecondsRuString(healReceivedDamageTime);
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.HealReceivedDamage).descriptionToken, string.Format("Upon {0}taking damage{1}, {2}heal{3} for {4}%{5} of the {6}damage taken{7} over the course of {8} {9}{10}", "<style=cIsDamage>", "</style>", "<style=cIsHealing>", "</style>", HealReceivedDamageEvents.HealReceivedHealCoefficient * 100f, GetStackString(HealReceivedDamageEvents.HealReceivedHealCoefficientPerStack * 100f, percentage: true, end: false), "<style=cIsDamage>", "</style>", healReceivedDamageTime, text, GetStackString(0f - HealReceivedDamageEvents.HealReceivedDamageStackTimeReduction, percentage: true, end: true)));
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.HealReceivedDamage).descriptionToken, string.Format("При {0}получении урона{1}, {2}исцели{3} 100% полученного урона на протяжении {4} {5}{6}", "<style=cIsDamage>", "</style>", "<style=cIsHealing>", "</style>", healReceivedDamageTime, secondsRuString, GetStackStringRu(0f - HealReceivedDamageEvents.HealReceivedDamageStackTimeReduction, percentage: true, end: true)), "ru");
		}

		public static void InitInfiniteSecondarySkillCharges()
		{
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges).nameToken, "Infinite Magazine");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges).nameToken, "Бесконечный магазин", "ru");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges).pickupToken, "Increase damage of your Secondary skill and gain infinite charges. Convert excessive charges into extra Secondary skill damage.");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges).pickupToken, "Увеличьте урон вторичного навыка и получите бесконечное количество зарядов. Превратите излишние заряды в дополнительный урон вторичного навыка.", "ru");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges).descriptionToken, string.Format("Use {0}Secondary skill{1} without minimal charge requirement. Consume all {2}Secondary skill{3} charges on skill execution, increasing {4}Secondary skill{5} {6}damage{7} by {8}{9}%{10} for each consumed charge. Extra {11}Secondary skill{12} {13}damage{14} {15}disappears{16} on dealing any {17}Secondary skill{18} {19}damage{20}. Increase {21}Secondary skill{22} {23}damage{24} by {25}{26}%{27}{28}", "<style=cIsUtility>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", "</style>", "<style=cIsDamage>", InfiniteSecondarySkillChargesEvents.buffDamage * 100f, "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", "</style>", "<style=cDeath>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", "</style>", "<style=cIsDamage>", InfiniteSecondarySkillChargesEvents.itemDamage * 100f, "</style>", GetStackString(InfiniteSecondarySkillChargesEvents.itemDamagePerStack * 100f, percentage: true, end: true)));
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges).descriptionToken, string.Format("Используйте {0}вторичный навык{1} без требования минимального количества зарядов. Поглотите все заряды {2}вторичного навыка{3} при использовании навыка, увеличивая {4}урон{5} {6}вторичного навыка{7} на {8}{9}%{10} за каждый поглощенный заряд. Дополнительный {11}урон{12} {13}вторичного навыка{14} {15}пропадает{16} при нанесения любого {17}урона{18} {19}вторичным навыком{20}. Увеличьте {21}урона{22} {23}вторичного навыка{24} на {25}{26}%{27}{28}", "<style=cIsUtility>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", InfiniteSecondarySkillChargesEvents.buffDamage * 100f, "</style>", "<style=cIsDamage>", "</style>", "<style=cIsUtility>", "</style>", "<style=cDeath>", "</style>", "<style=cIsDamage>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", "</style>", "<style=cIsUtility>", "</style>", "<style=cIsDamage>", InfiniteSecondarySkillChargesEvents.itemDamage * 100f, "</style>", GetStackStringRu(InfiniteSecondarySkillChargesEvents.itemDamagePerStack * 100f, percentage: true, end: true)), "ru");
		}

		public static void InitDrawSpeedPath()
		{
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.DrawSpeedPath).nameToken, "Chalk");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.DrawSpeedPath).nameToken, "Мел", "ru");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.DrawSpeedPath).pickupToken, "Draw a path as you move that increases movement speed and grants flight.");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.DrawSpeedPath).pickupToken, "Рисуйте путь пока передвигаетесь дающий свободное хождение с повышенной скоростью передвижения.", "ru");
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.DrawSpeedPath).descriptionToken, string.Format("Draw a path as you move. While on this path, increase {0}movement speed{1} by {2}{3}%{4}{5} and {6}gain flight{7}.", "<style=cIsUtility>", "</style>", "<style=cIsUtility>", DrawSpeedPathEvents.SpeedPathSpeedBonusCoefficient * 100f, "</style>", GetStackString(DrawSpeedPathEvents.SpeedPathSpeedBonusStackCoefficient * 100f, percentage: true, end: false), "<style=cIsUtility>", "</style>"));
			AddLanguageToken(((ItemDef)CaeliImperiumContent.Items.DrawSpeedPath).descriptionToken, string.Format("Рисуйте путь пока передвигаетесь. Хождение по проложенному пути повышает {0}скорость передвижения{1} на {2}{3}%{4}{5} и {6}даёт полет{7}.", "<style=cIsUtility>", "</style>", "<style=cIsUtility>", DrawSpeedPathEvents.SpeedPathSpeedBonusCoefficient * 100f, "</style>", GetStackStringRu(DrawSpeedPathEvents.SpeedPathSpeedBonusStackCoefficient * 100f, percentage: true, end: false), "<style=cIsUtility>", "</style>"), "ru");
		}

		public static void AddLanguageToken(string token, string text)
		{
			AddLanguageToken(token, text, "en");
		}

		public static void AddLanguageToken(string token, string text, string lang)
		{
			Language orCreateLanguage = Language.GetOrCreateLanguage(lang);
			if (orCreateLanguage != null)
			{
				if (orCreateLanguage.stringsByToken.ContainsKey(token))
				{
					orCreateLanguage.stringsByToken[token] = text;
				}
				else
				{
					orCreateLanguage.stringsByToken.Add(token, text);
				}
			}
		}

		public static string GetSecondsRuString(float time)
		{
			float num = MathF.Floor(time);
			if (time - num != 0f)
			{
				return "секунды";
			}
			float num2 = Mathf.Abs(num);
			if ((num2 >= 5f && num2 <= 10f) || num % 10f == 0f)
			{
				return "секунд";
			}
			if (num2 == 1f)
			{
				return "секунду";
			}
			return "секунды";
		}

		public static string GetStackString(float value, bool percentage, bool end)
		{
			if (value == 0f)
			{
				return "";
			}
			return " <style=cStack>(" + ((value > 0f) ? "+" : "") + value + (percentage ? "%" : "") + " per stack)</style>" + (end ? "." : "");
		}

		public static string GetStackStringRu(float value, bool percentage, bool end)
		{
			if (value == 0f)
			{
				return "";
			}
			return " <style=cStack>(" + ((value > 0f) ? "+" : "") + value + (percentage ? "%" : "") + " за шт.)</style>" + (end ? "." : "");
		}
	}
	public static class ModCompatabilities
	{
		public static class RiskOfOptionsCompatability
		{
			public const string GUID = "com.rune580.riskofoptions";

			public static void Init()
			{
				ModSettingsManager.SetModIcon(CaeliImperiumPlugin.expansionDef.iconSprite);
			}

			public static void AddConfig<T>(T config) where T : ConfigEntryBase
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Expected O, but got Unknown
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Expected O, but got Unknown
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Expected O, but got Unknown
				if (config is ConfigEntry<float>)
				{
					ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(config as ConfigEntry<float>));
				}
				else if (config is ConfigEntry<bool>)
				{
					ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(config as ConfigEntry<bool>));
				}
				else if (config is ConfigEntry<int>)
				{
					ModSettingsManager.AddOption((BaseOption)new IntFieldOption(config as ConfigEntry<int>));
				}
				else if (config is ConfigEntry<string>)
				{
					ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(config as ConfigEntry<string>));
				}
				else
				{
					ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)config));
				}
			}
		}
	}
	public static class Utils
	{
		public delegate void OnItemAdded(ItemDef itemDef);

		public const string NamePrefix = "_NAME";

		public const string PickupPrefix = "_PICKUP";

		public const string DescriptionPrefix = "_DESCRIPTION";

		public const string LorePrefix = "_LORE";

		public static int GetEquipmentCount(this CharacterBody characterBody, EquipmentDef equipmentDef)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return characterBody.GetEquipmentCount(equipmentDef.equipmentIndex);
		}

		public static int GetEquipmentCount(this CharacterBody characterBody, EquipmentIndex equipmentIndex)
		{
			return 0;
		}

		public static DotDef CreateDOT(BuffDef buffDef, out DotIndex dotIndex, bool resetTimerOnAdd, float interval, float damageCoefficient, DamageColorIndex damageColorIndex, CustomDotBehaviour customDotBehaviour, CustomDotVisual customDotVisual = null, CustomDotDamageEvaluation customDotDamageEvaluation = null, Action<DotDef> onDOTAdded = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected I4, but got Unknown
			DotDef val = new DotDef
			{
				resetTimerOnAdd = resetTimerOnAdd,
				interval = interval,
				damageCoefficient = damageCoefficient,
				damageColorIndex = damageColorIndex,
				associatedBuff = buffDef
			};
			dotIndex = (DotIndex)(int)DotAPI.RegisterDotDef(val, customDotBehaviour, customDotVisual, customDotDamageEvaluation);
			onDOTAdded?.Invoke(val);
			return val;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int SuperRoll(float chance)
		{
			int num = (int)MathF.Floor(chance / 100f);
			if (Util.CheckRoll(chance - (float)(num * 100), 0f, (CharacterMaster)null))
			{
				num++;
			}
			return num;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float ConvertAmplificationPercentageIntoReductionPercentage(float amplificationPercentage, float maxChance)
		{
			return (1f - maxChance / (maxChance + amplificationPercentage)) * maxChance;
		}

		public static GenericSkill CopyGenericSkill(GenericSkill genericSkill, CharacterBody bodyToTransferCopiedGenericSkill, string entityStateMachineName, Type mainStateType = null)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine val = ((Component)bodyToTransferCopiedGenericSkill).gameObject.AddComponent<EntityStateMachine>();
			SerializableEntityStateType val2 = default(SerializableEntityStateType);
			((SerializableEntityStateType)(ref val2))..ctor(mainStateType ?? typeof(Idle));
			val.mainStateType = val2;
			val.initialStateType = val2;
			val.customName = entityStateMachineName;
			GenericSkill val3 = ((Component)bodyToTransferCopiedGenericSkill).gameObject.AddComponent<GenericSkill>();
			if ((Object)(object)val3 != (Object)null)
			{
				val3._skillFamily = genericSkill.skillFamily;
				val3.Awake();
				val3.AssignSkill(genericSkill.baseSkill, false);
				val3.stateMachine = val;
				((Behaviour)val3).enabled = true;
			}
			return val3;
		}

		public static EquipmentPicker CreateEquipmentPicker()
		{
			Transform val = ((Object.op_Implicit((Object)(object)HUD.instancesList[0]) && Object.op_Implicit((Object)(object)HUD.instancesList[0].mainContainer)) ? HUD.instancesList[0].mainContainer.transform : null);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			return Object.Instantiate<GameObject>(CaeliImperiumAssets.EquipmentPicker, HUD.instancesList[0].mainContainer.transform).GetComponent<EquipmentPicker>();
		}

		public static void ModifyCharacterGravityParams(this CharacterBody characterBody, int i)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			ICharacterGravityParameterProvider component = ((Component)characterBody).GetComponent<ICharacterGravityParameterProvider>();
			if (component != null)
			{
				CharacterGravityParameters gravityParameters = component.gravityParameters;
				gravityParameters.environmentalAntiGravityGranterCount += i;
				component.gravityParameters = gravityParameters;
			}
			ICharacterFlightParameterProvider component2 = ((Component)characterBody).GetComponent<ICharacterFlightParameterProvider>();
			if (component2 != null)
			{
				CharacterFlightParameters flightParameters = component2.flightParameters;
				flightParameters.channeledFlightGranterCount += i;
				component2.flightParameters = flightParameters;
			}
		}

		public static ConfigEntry<T> CreateConfig<T>(string section, string key, T defaultValue, string description)
		{
			return CreateConfig(CaeliImperiumPlugin.configFile, section, key, defaultValue, description);
		}

		public static ConfigEntry<T> CreateConfig<T>(ConfigFile configFile, string section, string key, T defaultValue, string description)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			ConfigDefinition val = new ConfigDefinition(section, key);
			object obj = null;
			if (BrynzaAPI.defaultConfigValues.TryGetValue(configFile, out var value) && value.TryGetValue(val, out var value2) && configFile.OrphanedEntries.TryGetValue(val, out var value3) && value2 != defaultValue.ToString() && value2 == value3)
			{
				obj = defaultValue;
			}
			ConfigDescription val2 = new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>());
			ConfigEntry<T> val3 = configFile.Bind<T>(val, defaultValue, val2);
			if (obj != null)
			{
				val3.Value = (T)obj;
			}
			if (CaeliImperiumPlugin.riskOfOptionsEnabled)
			{
				ModCompatabilities.RiskOfOptionsCompatability.AddConfig<ConfigEntry<T>>(val3);
			}
			return val3;
		}

		public static T RegisterItemDef<T>(this T itemDef) where T : ItemDef
		{
			return itemDef.RegisterItemDef(null);
		}

		public static T RegisterItemDef<T>(this T itemDef, Action<T> onItemDefAdded) where T : ItemDef
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			if ((object)itemDef is CIItemDef cIItemDef)
			{
				string configName = cIItemDef.configName;
				if (!Utility.IsNullOrWhiteSpace(configName))
				{
					ConfigEntry<bool> val = CreateConfig(configName, "Enable", defaultValue: true, "Enable this item AKA \"" + ((Object)(object)itemDef).name + "\"?");
					if (!val.Value)
					{
						return default(T);
					}
					ConfigEntry<CIItemDef.ConfigItemTier> val2 = CreateConfig(configName, "Tier", cIItemDef.configItemTier, "Select tier for this item");
					ItemTier deprecatedTier;
					Sprite pickupIconSprite;
					switch (val2.Value)
					{
					case CIItemDef.ConfigItemTier.WhiteCommon:
						deprecatedTier = (ItemTier)0;
						pickupIconSprite = cIItemDef.commonTierSprite;
						break;
					case CIItemDef.ConfigItemTier.GreenUncommon:
						deprecatedTier = (ItemTier)1;
						pickupIconSprite = cIItemDef.uncommonTierSprite;
						break;
					case CIItemDef.ConfigItemTier.RedLegendary:
						deprecatedTier = (ItemTier)2;
						pickupIconSprite = cIItemDef.legendaryTierSprite;
						break;
					default:
						deprecatedTier = ((ItemDef)cIItemDef).deprecatedTier;
						pickupIconSprite = ((ItemDef)cIItemDef).pickupIconSprite;
						break;
					}
					((ItemDef)cIItemDef).deprecatedTier = deprecatedTier;
					((ItemDef)cIItemDef).pickupIconSprite = pickupIconSprite;
				}
			}
			CaeliImperiumContent.items.Add((ItemDef)(object)itemDef);
			onItemDefAdded?.Invoke(itemDef);
			return itemDef;
		}

		public static T RegisterEquipmentDef<T>(this T equipmentDef, Action<T> onEquipmentDefAdded = null) where T : EquipmentDef
		{
			CaeliImperiumContent.equipments.Add((EquipmentDef)(object)equipmentDef);
			onEquipmentDefAdded?.Invoke(equipmentDef);
			return equipmentDef;
		}

		public static T RegisterEliteDef<T>(this T eliteDef, Action<T> onEliteDefAdded = null) where T : EliteDef
		{
			CaeliImperiumContent.elites.Add((EliteDef)(object)eliteDef);
			onEliteDefAdded?.Invoke(eliteDef);
			return eliteDef;
		}

		public static T RegisterBuffDef<T>(this T buffDef, Action<T> onBuffDefAdded = null) where T : BuffDef
		{
			CaeliImperiumContent.buffs.Add((BuffDef)(object)buffDef);
			onBuffDefAdded?.Invoke(buffDef);
			return buffDef;
		}

		public static T RegisterExpansionDef<T>(this T expansionsDef, Action<T> onExpansionDefAdded = null) where T : ExpansionDef
		{
			CaeliImperiumContent.expansions.Add((ExpansionDef)(object)expansionsDef);
			onExpansionDefAdded?.Invoke(expansionsDef);
			return expansionsDef;
		}

		public static float Stack(this int stack, float nonStackValue, float stackValue)
		{
			return nonStackValue + (float)(stack - 1) * stackValue;
		}

		public static int Stack(this int stack, int nonStackValue, int stackValue)
		{
			return nonStackValue + (stack - 1) * stackValue;
		}
	}
}
namespace CaeliImperium.Items
{
	[CreateAssetMenu(menuName = "RoR2/CIItemDef")]
	public class CIItemDef : ItemDef
	{
		public enum ConfigItemTier
		{
			WhiteCommon,
			GreenUncommon,
			RedLegendary
		}

		public string configName;

		public ConfigItemTier configItemTier;

		public Sprite commonTierSprite;

		public Sprite uncommonTierSprite;

		public Sprite legendaryTierSprite;
	}
	public static class DrawSpeedPathEvents
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action<CharacterBody> <0>__Events_OnInventoryChanged;

			public static StatHookEventHandler <1>__Events_GetStatCoefficients;

			public static Action<CharacterBody, BuffDef> <2>__Events_OnBuffFirstStackGained;

			public static Action<CharacterBody, BuffDef> <3>__Events_OnBuffFinalStackLost;

			public static Action <4>__OnPluginDestroyed;
		}

		public static float SpeedPathSpeedBonusCoefficient => DrawSpeedPathConfigs.SpeedPathSpeedBonusCoefficient.Value;

		public static float SpeedPathSpeedBonusStackCoefficient => DrawSpeedPathConfigs.SpeedPathSpeedBonusStackCoefficient.Value;

		public static void Init(ItemDef itemDef)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			CaeliImperiumContent.Buffs.SpeedPathSpeedBonus = CaeliImperiumAssets.assetBundle.LoadAsset<BuffDef>("Assets/CaeliImperium/Buffs/SpeedPathSpeedBonus.asset").RegisterBuffDef<BuffDef>((Action<BuffDef>)null);
			Hooks.OnInventoryChanged += Events_OnInventoryChanged;
			object obj = <>O.<1>__Events_GetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val = Events_GetStatCoefficients;
				<>O.<1>__Events_GetStatCoefficients = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			Hooks.OnBuffFirstStackGained += Events_OnBuffFirstStackGained;
			Hooks.OnBuffFinalStackLost += Events_OnBuffFinalStackLost;
			CaeliImperiumPlugin.OnPluginDestroyed = (Action)Delegate.Combine(CaeliImperiumPlugin.OnPluginDestroyed, new Action(OnPluginDestroyed));
		}

		public static void Events_OnInventoryChanged(CharacterBody obj)
		{
			int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCountEffective((ItemDef)(object)CaeliImperiumContent.Items.DrawSpeedPath) : 0);
			obj.AddItemBehavior<DrawSpeedPathBehaviour>(num);
		}

		public static void Events_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			int buffCount = sender.GetBuffCount(CaeliImperiumContent.Buffs.SpeedPathSpeedBonus);
			args.moveSpeedMultAdd += buffCount.Stack(SpeedPathSpeedBonusCoefficient, SpeedPathSpeedBonusStackCoefficient);
		}

		public static void Events_OnBuffFinalStackLost(CharacterBody arg1, BuffDef arg2)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (arg2.buffIndex == CaeliImperiumContent.Buffs.SpeedPathSpeedBonus.buffIndex)
			{
				arg1.ModifyCharacterGravityParams(-1);
			}
		}

		public static void Events_OnBuffFirstStackGained(CharacterBody arg1, BuffDef arg2)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (arg2.buffIndex == CaeliImperiumContent.Buffs.SpeedPathSpeedBonus.buffIndex)
			{
				arg1.ModifyCharacterGravityParams(1);
			}
		}

		public static void OnPluginDestroyed()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			CaeliImperiumPlugin.OnPluginDestroyed = (Action)Delegate.Remove(CaeliImperiumPlugin.OnPluginDestroyed, new Action(OnPluginDestroyed));
			Hooks.OnInventoryChanged -= Events_OnInventoryChanged;
			object obj = <>O.<1>__Events_GetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val = Events_GetStatCoefficients;
				<>O.<1>__Events_GetStatCoefficients = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj;
			Hooks.OnBuffFirstStackGained -= Events_OnBuffFirstStackGained;
			Hooks.OnBuffFinalStackLost -= Events_OnBuffFinalStackLost;
		}
	}
	public static class HealReceivedDamageEvents
	{
		public static float HealReceivedHealCoefficient => HealReceivedDamageConfigs.HealReceivedDamageHealCoefficient.Value;

		public static float HealReceivedHealCoefficientPerStack => HealReceivedDamageConfigs.HealReceivedDamageHealCoefficientPerStack.Value;

		public static float HealReceivedDamageTime => HealReceivedDamageConfigs.HealReceivedDamageTime.Value;

		public static float HealReceivedDamageStackTimeReduction => HealReceivedDamageConfigs.HealReceivedDamageStackTimeReduction.Value;

		public static void Init(ItemDef itemDef)
		{
			Hooks.OnInventoryChanged += Events_OnInventoryChanged;
			CaeliImperiumPlugin.OnPluginDestroyed = (Action)Delegate.Combine(CaeliImperiumPlugin.OnPluginDestroyed, new Action(OnPluginDestroyed));
		}

		private static void OnPluginDestroyed()
		{
			Hooks.OnInventoryChanged -= Events_OnInventoryChanged;
			CaeliImperiumPlugin.OnPluginDestroyed = (Action)Delegate.Remove(CaeliImperiumPlugin.OnPluginDestroyed, new Action(OnPluginDestroyed));
		}

		public static void Events_OnInventoryChanged(CharacterBody obj)
		{
			if (NetworkServer.active)
			{
				int num = (Object.op_Implicit((Object)(object)obj.inventory) ? obj.inventory.GetItemCountEffective((ItemDef)(object)CaeliImperiumContent.Items.HealReceivedDamage) : 0);
				obj.AddItemBehavior<HealReceivedDamageBehaviour>(num);
			}
		}
	}
	public static class InfiniteSecondarySkillChargesEvents
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Func<int, GenericSkill, int> <0>__HandleInfiniteSecondarySkillCharges;

			public static hook_HasRequiredStockAndDelay <1>__SkillDef_HasRequiredStockAndDelay;

			public static Manipulator <2>__Patch;

			public static Hooks.HealthComponent_TakeDamageProcess_Delegate <3>__Events_OnTakeDamageProcess;

			public static Action <4>__OnPluginDestroyed;
		}

		private static List<SkillDef> blacklistedSkillDefs = new List<SkillDef>();

		public static float buffDamage => InfiniteSecondarySkillChargesConfigs.InfiniteSecondarySkillChargesDamagePerCharge.Value;

		public static float itemDamage => InfiniteSecondarySkillChargesConfigs.InfiniteSecondarySkillChargesDamage.Value;

		public static float itemDamagePerStack => InfiniteSecondarySkillChargesConfigs.InfiniteSecondarySkillChargesDamagePerStack.Value;

		public static void SkillDef_OnExecute(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<SkillDef>(x, "stockToConsume")
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<int, GenericSkill, int>>((Func<int, GenericSkill, int>)HandleInfiniteSecondarySkillCharges);
			}
			else
			{
				CaeliImperiumPlugin.Log.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
			}
		}

		public static void Patch(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<SkillDef>(x, "stockToConsume")
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<int, GenericSkill, int>>((Func<int, GenericSkill, int>)HandleInfiniteSecondarySkillCharges);
			}
		}

		public static int HandleInfiniteSecondarySkillCharges(int stockToConsume, GenericSkill genericSkill)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (!Check(genericSkill))
			{
				return stockToConsume;
			}
			CharacterBody characterBody = genericSkill.characterBody;
			if (Util.HasEffectiveAuthority(characterBody.networkIdentity))
			{
				int num = genericSkill.stock / ((genericSkill.rechargeStock <= 0) ? 1 : genericSkill.rechargeStock);
				int buffCount = characterBody.GetBuffCount(CaeliImperiumContent.Buffs.IncreaseSecondarySkillDamage);
				if (num > buffCount)
				{
					NetworkingHelpers.ApplyBuff(characterBody, CaeliImperiumContent.Buffs.IncreaseSecondarySkillDamage.buffIndex, num, -1f);
				}
			}
			return blacklistedSkillDefs.Contains(genericSkill.skillDef) ? stockToConsume : genericSkill.stock;
		}

		public static bool SkillDef_HasRequiredStockAndDelay(orig_HasRequiredStockAndDelay orig, SkillDef self, GenericSkill skillSlot)
		{
			bool flag = orig.Invoke(self, skillSlot);
			if (!flag)
			{
				return Check(skillSlot);
			}
			return flag;
		}

		private static bool Check(GenericSkill genericSkill)
		{
			if (!Object.op_Implicit((Object)(object)genericSkill))
			{
				return false;
			}
			CharacterBody characterBody = genericSkill.characterBody;
			if (!Object.op_Implicit((Object)(object)characterBody))
			{
				return false;
			}
			SkillLocator skillLocator = characterBody.skillLocator;
			if (!Object.op_Implicit((Object)(object)skillLocator))
			{
				return false;
			}
			if ((Object)(object)skillLocator.secondary != (Object)(object)genericSkill)
			{
				return false;
			}
			Inventory inventory = characterBody.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return false;
			}
			int itemCountEffective = inventory.GetItemCountEffective((ItemDef)(object)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges);
			if (itemCountEffective <= 0)
			{
				return false;
			}
			return true;
		}

		public static void Events_OnTakeDamageProcess(HealthComponent healthComponent, DamageInfo damageInfo, CharacterBody characterBody, ref float damage)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (((Enum)damageInfo.damageType.damageSource).HasFlag((Enum)(object)(DamageSource)2))
			{
				int buffCount = characterBody.GetBuffCount(CaeliImperiumContent.Buffs.IncreaseSecondarySkillDamage);
				float num = 1f;
				if (buffCount > 0)
				{
					num += (float)buffCount * buffDamage;
					characterBody.SetBuffCount(CaeliImperiumContent.Buffs.IncreaseSecondarySkillDamage.buffIndex, 0);
				}
				if (Object.op_Implicit((Object)(object)characterBody.inventory))
				{
					int itemCountEffective = characterBody.inventory.GetItemCountEffective((ItemDef)(object)CaeliImperiumContent.Items.InfiniteSecondarySkillCharges);
					num += itemCountEffective.Stack(itemDamage, itemDamagePerStack);
				}
				damage *= num;
			}
		}

		public static void Init(ItemDef itemDef)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: