Decompiled source of Quality v0.6.1

plugins/Quality/ItemQualities.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using AK.Wwise;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Bandit2;
using EntityStates.Barrel;
using EntityStates.BossGroupHealNovaController;
using EntityStates.BrotherMonster;
using EntityStates.CaptainSupplyDrop;
using EntityStates.Drifter;
using EntityStates.Drone.DroneJunk;
using EntityStates.Engi.Mine;
using EntityStates.FalseSon;
using EntityStates.FalseSonBoss;
using EntityStates.FriendUnit;
using EntityStates.GolemMonster;
using EntityStates.Halcyonite;
using EntityStates.Headstompers;
using EntityStates.ImpBossMonster;
using EntityStates.JellyfishMonster;
using EntityStates.JunkCube;
using EntityStates.LaserTurbine;
using EntityStates.Mage;
using EntityStates.Missions.Goldshores;
using EntityStates.MushroomShield;
using EntityStates.ParentMonster;
using EntityStates.ScavMonster;
using EntityStates.Seeker;
using EntityStates.SharedSufferingOrb;
using EntityStates.VagrantMonster;
using EntityStates.VagrantNovaItem;
using EntityStates.Vehicles;
using HG;
using HG.Coroutines;
using HG.GeneralSerializer;
using HG.Reflection;
using IL.EntityStates;
using IL.EntityStates.Bandit2;
using IL.EntityStates.BrotherMonster;
using IL.EntityStates.CaptainSupplyDrop;
using IL.EntityStates.Chef;
using IL.EntityStates.Drifter;
using IL.EntityStates.Drone.DroneBombardment;
using IL.EntityStates.Drone.DroneJunk;
using IL.EntityStates.FalseSon;
using IL.EntityStates.FalseSonBoss;
using IL.EntityStates.GolemMonster;
using IL.EntityStates.Halcyonite;
using IL.EntityStates.Headstompers;
using IL.EntityStates.ImpBossMonster;
using IL.EntityStates.JellyfishMonster;
using IL.EntityStates.JunkCube;
using IL.EntityStates.Mage;
using IL.EntityStates.ParentMonster;
using IL.EntityStates.ScavMonster;
using IL.EntityStates.Seeker;
using IL.EntityStates.SolusAmalgamator;
using IL.EntityStates.VagrantMonster;
using IL.EntityStates.VagrantNovaItem;
using IL.RoR2;
using IL.RoR2.Items;
using IL.RoR2.Orbs;
using IL.RoR2.Projectile;
using IL.RoR2.UI;
using IL.RoR2.VoidRaidCrab;
using ItemQualities;
using ItemQualities.Config;
using ItemQualities.ContentManagement;
using ItemQualities.Items;
using ItemQualities.ModCompatibility;
using ItemQualities.Orbs;
using ItemQualities.Utilities;
using ItemQualities.Utilities.Extensions;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using On.EntityStates.Drifter;
using On.EntityStates.FalseSon;
using On.EntityStates.Missions.Goldshores;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.Items;
using On.RoR2.Projectile;
using On.RoR2.SolusWingGrid;
using On.RoR2.UI;
using On.RoR2.UI.LogBook;
using R2API;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.EntitlementManagement;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.SolusWingGrid;
using RoR2.UI;
using RoR2.UI.LogBook;
using RoR2.VoidRaidCrab;
using RoR2BepInExPack.GameAssetPaths.Version_1_35_0;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using RoR2BepInExPack.Utilities;
using ShaderSwapper;
using TMPro;
using Unity;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[assembly: OptIn]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace EntityStates.SharedSufferingOrb
{
	public sealed class SharedSufferingOrbDeath : EntityState
	{
		private static GameObject _deathEffectPrefab;

		public static float ExplosionDamageCoefficient;

		public static float ExplosionForce;

		[ContentInitializer]
		private static IEnumerator LoadContent(ContentIntializerArgs args)
		{
			//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)
			AsyncOperationHandle<GameObject> val = AddressableUtil.LoadTempAssetAsync<GameObject>(RoR2_Base_WeeklyRun.TimeCrystalDeath_prefab);
			val.OnSuccess(delegate(GameObject timeCrystalDeath)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				_deathEffectPrefab = PrefabAPI.InstantiateClone(timeCrystalDeath, "SharedSufferingOrbDeathEffect", false);
				args.ContentPack.effectDefs.Add<EffectDef>(new EffectDef(_deathEffectPrefab));
			});
			return val.AsProgressCoroutine<GameObject>(args.ProgressReceiver);
		}

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			explode();
		}

		private void explode()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelBaseTransform))
				{
					EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelBaseTransform).gameObject);
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelTransform))
				{
					EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelTransform).gameObject);
				}
			}
			SharedSufferingOrbController component = ((EntityState)this).GetComponent<SharedSufferingOrbController>();
			float num = (Object.op_Implicit((Object)(object)component) ? component.BlastRadius : 0f);
			if (Object.op_Implicit((Object)(object)_deathEffectPrefab))
			{
				EffectManager.SpawnEffect(_deathEffectPrefab, new EffectData
				{
					origin = ((EntityState)this).transform.position,
					scale = num,
					rotation = Quaternion.identity
				}, false);
			}
			if (NetworkServer.active)
			{
				GenericOwnership component2 = ((EntityState)this).GetComponent<GenericOwnership>();
				GameObject val = (Object.op_Implicit((Object)(object)component2) ? component2.ownerObject : null);
				CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
				TeamIndex val3 = (TeamIndex)((!Object.op_Implicit((Object)(object)val2)) ? (-1) : ((int)val2.teamComponent.teamIndex));
				Vector3 position = ((EntityState)this).transform.position;
				float damage = ExplosionDamageCoefficient * (Object.op_Implicit((Object)(object)val2) ? val2.damage : Run.instance.teamlessDamageCoefficient);
				foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
				{
					if (FriendlyFireManager.ShouldSplashHitProceed(readOnlyInstances.healthComponent, val3) && !((Object)(object)readOnlyInstances == (Object)(object)val2) && !((Object)(object)readOnlyInstances == (Object)(object)((EntityState)this).characterBody) && !(Vector3.Distance(readOnlyInstances.corePosition, position) >= num))
					{
						DamageInfo val4 = new DamageInfo
						{
							attacker = val,
							inflictor = ((EntityState)this).gameObject,
							damage = damage,
							crit = (Object.op_Implicit((Object)(object)val2) && val2.RollCrit()),
							damageType = DamageTypeCombo.op_Implicit((DamageType)131072),
							damageColorIndex = (DamageColorIndex)16,
							procCoefficient = 0f,
							position = position
						};
						float explosionForce = ExplosionForce;
						Vector3 val5 = readOnlyInstances.corePosition - position;
						val4.force = explosionForce * ((Vector3)(ref val5)).normalized + ExplosionForce * 0.5f * Vector3.up;
						DamageInfo val6 = val4;
						DamageAPI.AddModdedDamageType(ref val6.damageType, DamageTypes.ForceAddToSharedSuffering);
						readOnlyInstances.healthComponent.TakeDamage(val6);
						GlobalEventManager.instance.OnHitEnemy(val6, ((Component)readOnlyInstances).gameObject);
						GlobalEventManager.instance.OnHitAll(val6, ((Component)readOnlyInstances).gameObject);
					}
				}
			}
			EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)9;
		}
	}
}
namespace EntityStates.MushroomShield
{
	public abstract class MushroomBubbleBaseState : EntityState
	{
		[NonSerialized]
		public float EffectRadius;

		public override void OnSerialize(NetworkWriter writer)
		{
			((EntityState)this).OnSerialize(writer);
			writer.Write(EffectRadius);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((EntityState)this).OnDeserialize(reader);
			EffectRadius = reader.ReadSingle();
		}

		public override void ModifyNextState(EntityState nextState)
		{
			((EntityState)this).ModifyNextState(nextState);
			if (nextState is MushroomBubbleBaseState mushroomBubbleBaseState)
			{
				mushroomBubbleBaseState.EffectRadius = EffectRadius;
			}
		}

		public abstract void Undeploy(bool immediate);
	}
	public sealed class MushroomBubbleDeploy : MushroomBubbleBaseState
	{
		public static string StartSoundString;

		private CharacterBody _ownerBody;

		private float _startMoveStopwatchValue;

		private float _undeployLifetime;

		public override void OnEnter()
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnEnter();
			Util.PlaySound(StartSoundString, ((EntityState)this).gameObject);
			GenericOwnership component = ((EntityState)this).GetComponent<GenericOwnership>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.ownerObject))
			{
				return;
			}
			_ownerBody = component.ownerObject.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)_ownerBody) && Object.op_Implicit((Object)(object)_ownerBody.inventory))
			{
				ItemQualityCounts itemCountsEffective = _ownerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Mushroom);
				_undeployLifetime = itemCountsEffective.UncommonCount + 3 * itemCountsEffective.RareCount + 6 * itemCountsEffective.EpicCount + 12 * itemCountsEffective.LegendaryCount;
				float num = 30f;
				switch (itemCountsEffective.HighestQuality)
				{
				case QualityTier.Uncommon:
					num = 30f;
					break;
				case QualityTier.Rare:
					num = 25f;
					break;
				case QualityTier.Epic:
					num = 20f;
					break;
				case QualityTier.Legendary:
					num = 15f;
					break;
				}
				EffectRadius = num;
				((EntityState)this).transform.localScale = Vector3.one * (num / 20f);
				_startMoveStopwatchValue = _ownerBody.notMovingStopwatch;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && (!Object.op_Implicit((Object)(object)_ownerBody) || !Object.op_Implicit((Object)(object)_ownerBody.healthComponent) || !_ownerBody.healthComponent.alive || _ownerBody.notMovingStopwatch < _startMoveStopwatchValue))
			{
				Undeploy(immediate: false);
			}
		}

		public override void Undeploy(bool immediate)
		{
			if (((EntityState)this).isAuthority)
			{
				if (immediate)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleFlashOut());
					return;
				}
				((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleUndeploy
				{
					Duration = _undeployLifetime
				});
			}
		}
	}
	public sealed class MushroomBubbleFlashOut : MushroomBubbleBaseState
	{
		private static EffectIndex _bubbleShieldEndEffect = (EffectIndex)(-1);

		public static string EndSoundString;

		public static float Duration;

		private BeginRapidlyActivatingAndDeactivating _blinkController;

		[SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })]
		private static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			_bubbleShieldEndEffect = EffectCatalogUtils.FindEffectIndex("BubbleShieldEndEffect");
			if ((int)_bubbleShieldEndEffect == -1)
			{
				Log.Warning("Failed to find charge effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\MushroomShield\\MushroomBubbleFlashOut.cs", "Init", 16);
			}
		}

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			_blinkController = ((EntityState)this).GetComponent<BeginRapidlyActivatingAndDeactivating>();
			if (Object.op_Implicit((Object)(object)_blinkController))
			{
				_blinkController.delayBeforeBeginningBlinking = 0f;
				_blinkController.fixedAge = 0f;
				((Behaviour)_blinkController).enabled = true;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration)
			{
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}

		public override void OnExit()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0021: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			((EntityState)this).OnExit();
			EffectManager.SpawnEffect(_bubbleShieldEndEffect, new EffectData
			{
				origin = ((EntityState)this).transform.position,
				rotation = ((EntityState)this).transform.rotation,
				scale = EffectRadius
			}, false);
			Util.PlaySound(EndSoundString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)_blinkController))
			{
				((Behaviour)_blinkController).enabled = false;
			}
		}

		public override void Undeploy(bool immediate)
		{
		}
	}
	public sealed class MushroomBubbleUndeploy : MushroomBubbleBaseState
	{
		[NonSerialized]
		public float Duration;

		public override void OnSerialize(NetworkWriter writer)
		{
			base.OnSerialize(writer);
			writer.Write(Duration);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			base.OnDeserialize(reader);
			Duration = reader.ReadSingle();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration - MushroomBubbleFlashOut.Duration)
			{
				Undeploy(immediate: true);
			}
		}

		public override void Undeploy(bool immediate)
		{
			if (((EntityState)this).isAuthority && immediate)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleFlashOut());
			}
		}
	}
}
namespace EntityStates.FriendUnit
{
	public sealed class FriendUnitPunt : BaseState
	{
		public static float BaseVelocity;

		public static float MaxLockOnAngle;

		public static float MaxDistance;

		public static float LaunchHorizontalSpeedMultiplier;

		public static string PuntSound;

		[NonSerialized]
		public GameObject Punter;

		[NonSerialized]
		public Ray AimRay;

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnSerialize(writer);
			writer.Write(Punter);
			writer.Write(AimRay);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			Punter = reader.ReadGameObject();
			AimRay = reader.ReadRay();
		}

		public override void OnEnter()
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.isSprinting = true;
			}
			((BaseState)this).OnEnter();
			if (((EntityState)this).isAuthority)
			{
				BullseyeSearch val = new BullseyeSearch
				{
					searchOrigin = ((Ray)(ref AimRay)).origin,
					searchDirection = ((Ray)(ref AimRay)).direction,
					viewer = (Object.op_Implicit((Object)(object)Punter) ? Punter.GetComponent<CharacterBody>() : null),
					filterByLoS = true,
					filterByDistinctEntity = true,
					maxAngleFilter = MaxLockOnAngle,
					maxDistanceFilter = MaxDistance,
					sortMode = (SortMode)2,
					queryTriggerInteraction = (QueryTriggerInteraction)1,
					teamMaskFilter = TeamMask.GetEnemyTeams(TeamComponent.GetObjectTeam(Punter))
				};
				val.RefreshCandidates();
				Vector3 val2 = Vector3.zero;
				IPhysMotor val3 = default(IPhysMotor);
				if (Object.op_Implicit((Object)(object)Punter) && Punter.TryGetComponent<IPhysMotor>(ref val3))
				{
					val2 = val3.velocity;
				}
				Vector3 val4 = val2;
				val4.y = 0f;
				float num = ((Vector3)(ref val4)).magnitude + BaseVelocity + base.moveSpeedStat * LaunchHorizontalSpeedMultiplier;
				Vector3 force = ((Ray)(ref AimRay)).direction * num;
				using (IEnumerator<HurtBox> enumerator = val.GetResults().GetEnumerator())
				{
					if (enumerator.MoveNext())
					{
						HurtBox current = enumerator.Current;
						force = Trajectory.CalculateInitialVelocityFromHSpeed(((EntityState)this).transform.position, ((Component)current).transform.position, num, 0f, float.PositiveInfinity);
					}
				}
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				PhysForceInfo val5 = new PhysForceInfo
				{
					force = force
				};
				((PhysForceInfo)(ref val5)).massIsOne = true;
				((PhysForceInfo)(ref val5)).disableAirControlUntilCollision = true;
				((PhysForceInfo)(ref val5)).resetVelocity = true;
				((PhysForceInfo)(ref val5)).ignoreGroundStick = true;
				characterMotor.ApplyForceImpulse(ref val5);
				((EntityState)this).characterMotor.onMovementHit += new MovementHitDelegate(onMovementHit);
			}
			Util.PlaySound(PuntSound, ((EntityState)this).gameObject);
		}

		public override void OnExit()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			((EntityState)this).OnExit();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.isSprinting = false;
				((EntityState)this).characterMotor.onMovementHit -= new MovementHitDelegate(onMovementHit);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.isSprinting = true;
			}
		}

		private void onMovementHit(ref MovementHitInfo movementHitInfo)
		{
			//IL_0019: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).outer.SetNextState((EntityState)(object)new FriendUnitPuntImpact
			{
				Punter = Punter,
				ImpactPoint = movementHitInfo.hitPoint,
				ImpactNormal = movementHitInfo.hitNormal,
				ImpactVelocity = movementHitInfo.velocity,
				DamageMultiplierFromSpeed = Mathf.Max(1f, ((Vector3)(ref movementHitInfo.velocity)).magnitude / base.moveSpeedStat)
			});
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public sealed class FriendUnitPuntImpact : BaseState
	{
		private static EffectIndex _explosionEffectIndex = (EffectIndex)(-1);

		public static float ImpactBounciness;

		public static string ImpactSoundString;

		public static float ReturnVelocityMaxAngleDelta;

		public static float ReturnVelocityMaxMagnitudeMultiplier = 1f;

		[NonSerialized]
		public GameObject Punter;

		[NonSerialized]
		public Vector3 ImpactPoint;

		[NonSerialized]
		public Vector3 ImpactNormal;

		[NonSerialized]
		public Vector3 ImpactVelocity;

		[NonSerialized]
		public float DamageMultiplierFromSpeed;

		[SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })]
		private static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			_explosionEffectIndex = EffectCatalogUtils.FindEffectIndex("OmniExplosionVFXRoboBallDeath");
			if ((int)_explosionEffectIndex == -1)
			{
				Log.Error("Failed to find explosion effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\FriendUnit\\FriendUnitPuntImpact.cs", "Init", 21);
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnSerialize(writer);
			writer.Write(Punter);
			writer.Write(ImpactPoint);
			writer.Write(ImpactNormal);
			writer.Write(ImpactVelocity);
			writer.Write(DamageMultiplierFromSpeed);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			Punter = reader.ReadGameObject();
			ImpactPoint = reader.ReadVector3();
			ImpactNormal = reader.ReadVector3();
			ImpactVelocity = reader.ReadVector3();
			DamageMultiplierFromSpeed = reader.ReadSingle();
		}

		public override void OnEnter()
		{
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Invalid comparison between Unknown and I4
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			if (NetworkServer.active)
			{
				CharacterMaster master = ((EntityState)this).characterBody.master;
				ItemQualityCounts itemQualityCounts = default(ItemQualityCounts);
				if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.minionOwnership.ownerMaster) && Object.op_Implicit((Object)(object)master.minionOwnership.ownerMaster.inventory))
				{
					itemQualityCounts = master.minionOwnership.ownerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PhysicsProjectile);
				}
				if (itemQualityCounts.TotalQualityCount == 0)
				{
					itemQualityCounts.UncommonCount = 1;
				}
				float num;
				switch (itemQualityCounts.HighestQuality)
				{
				case QualityTier.Uncommon:
					num = 4f;
					break;
				case QualityTier.Rare:
					num = 6f;
					break;
				case QualityTier.Epic:
					num = 8f;
					break;
				case QualityTier.Legendary:
					num = 10f;
					break;
				default:
					Log.Error($"Quality tier {itemQualityCounts.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\FriendUnit\\FriendUnitPuntImpact.cs", "OnEnter", 101);
					num = 1f;
					break;
				}
				float radius = 10f * (float)itemQualityCounts.UncommonCount + 15f * (float)itemQualityCounts.RareCount + 25f * (float)itemQualityCounts.EpicCount + 35f * (float)itemQualityCounts.LegendaryCount;
				radius = ExplodeOnDeath.GetExplosionRadius(radius, ((EntityState)this).characterBody);
				BlastAttack val = new BlastAttack
				{
					position = ImpactPoint,
					radius = radius,
					baseDamage = num * base.damageStat * DamageMultiplierFromSpeed,
					damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)32), (DamageTypeExtended)0, (DamageSource)1),
					crit = ((BaseState)this).RollCrit(),
					attacker = (Object.op_Implicit((Object)(object)Punter) ? Punter : ((EntityState)this).gameObject),
					inflictor = ((EntityState)this).gameObject,
					attackerFiltering = (AttackerFiltering)2,
					damageColorIndex = (DamageColorIndex)3,
					falloffModel = (FalloffModel)3,
					procCoefficient = 1f,
					teamIndex = ((BaseState)this).GetTeam()
				};
				val.Fire();
				if ((int)_explosionEffectIndex != -1)
				{
					EffectManager.SpawnEffect(_explosionEffectIndex, new EffectData
					{
						origin = val.position,
						scale = val.radius
					}, true);
				}
			}
			Util.PlaySound(ImpactSoundString, ((EntityState)this).gameObject);
			EffectManager.SimpleImpactEffect(KineticAura.knockbackEffectPrefab, ImpactPoint, -ImpactNormal, false);
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (ImpactVelocity == Vector3.zero)
			{
				ImpactVelocity = ((EntityState)this).characterMotor.velocity;
			}
			Vector3 val3;
			if (ImpactNormal != Vector3.zero)
			{
				Vector3 val2 = Vector3.Reflect(((Vector3)(ref ImpactVelocity)).normalized, ImpactNormal);
				float num2 = ((Vector3)(ref ImpactVelocity)).magnitude * ImpactBounciness;
				val3 = val2 * num2;
			}
			else
			{
				val3 = ((EntityState)this).characterMotor.velocity * (0f - ImpactBounciness);
			}
			if (Object.op_Implicit((Object)(object)Punter))
			{
				Vector3 val4 = Trajectory.CalculateInitialVelocityFromHSpeed(((EntityState)this).transform.position, Punter.transform.position, ((Vector3)(ref ImpactVelocity)).magnitude, 0f, float.PositiveInfinity);
				float num3 = Mathf.Min(((Vector3)(ref val4)).magnitude / ((Vector3)(ref val3)).magnitude, ReturnVelocityMaxMagnitudeMultiplier);
				Quaternion val5 = Quaternion.identity;
				if (ReturnVelocityMaxAngleDelta > 0f)
				{
					val5 = Quaternion.FromToRotation(val3, val4);
					Vector3 val6 = default(Vector3);
					float num4 = default(float);
					((Quaternion)(ref val5)).ToAngleAxis(ref num4, ref val6);
					num4 = Mathf.MoveTowardsAngle(0f, num4, ReturnVelocityMaxAngleDelta);
					val5 = Quaternion.AngleAxis(num4, val6);
				}
				val3 = val5 * val3 * num3;
			}
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			PhysForceInfo val7 = new PhysForceInfo
			{
				force = val3
			};
			((PhysForceInfo)(ref val7)).resetVelocity = true;
			((PhysForceInfo)(ref val7)).disableAirControlUntilCollision = true;
			((PhysForceInfo)(ref val7)).ignoreGroundStick = true;
			((PhysForceInfo)(ref val7)).massIsOne = true;
			characterMotor.ApplyForceImpulse(ref val7);
			((EntityState)this).outer.SetNextStateToMain();
		}
	}
}
namespace EntityStates.BossGroupHealNovaController
{
	public class BossGroupHealNovaPulse : EntityState
	{
		private class HealPulse
		{
			private readonly HashSet<HealthComponent> _healedTargets = new HashSet<HealthComponent>();

			private readonly SphereSearch _sphereSearch;

			private readonly float _duration;

			private readonly float _finalRadius;

			private readonly float _healFractionValue;

			private readonly TeamMask _teamMask;

			private readonly List<HurtBox> _hurtBoxesList = new List<HurtBox>();

			private float _timeElapsed;

			public HealPulse(Vector3 origin, float finalRadius, float healFractionValue, float duration, TeamIndex teamIndex)
			{
				//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: 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_0032: 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_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0050: Expected O, but got Unknown
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				_sphereSearch = new SphereSearch
				{
					mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
					origin = origin,
					queryTriggerInteraction = (QueryTriggerInteraction)2,
					radius = 0f
				};
				_finalRadius = finalRadius;
				_healFractionValue = healFractionValue;
				_duration = duration;
				_teamMask = default(TeamMask);
				((TeamMask)(ref _teamMask)).AddTeam(teamIndex);
			}

			public void Update(float deltaTime)
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				_timeElapsed += deltaTime;
				float num = Mathf.Clamp01(_timeElapsed / _duration);
				_sphereSearch.radius = _finalRadius * NovaRadiusCurve.Evaluate(num);
				_sphereSearch.RefreshCandidates().FilterCandidatesByHurtBoxTeam(_teamMask).FilterCandidatesByDistinctHurtBoxEntities()
					.GetHurtBoxes(_hurtBoxesList);
				foreach (HurtBox hurtBoxes in _hurtBoxesList)
				{
					if (_healedTargets.Add(hurtBoxes.healthComponent))
					{
						healTarget(hurtBoxes.healthComponent);
					}
				}
				_hurtBoxesList.Clear();
			}

			private void healTarget(HealthComponent target)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				target.HealFraction(_healFractionValue, default(ProcChainMask));
				Util.PlaySound("Play_item_proc_TPhealingNova_hitPlayer", ((Component)target).gameObject);
			}
		}

		public static AnimationCurve NovaRadiusCurve;

		public static float GrowDuration;

		public static float LingerDuration;

		private float _totalDuration;

		private Transform _effectTransform;

		private HealPulse _healPulse;

		private float _radius;

		public override void OnEnter()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnEnter();
			_totalDuration = GrowDuration + LingerDuration;
			BossGroupHealNovaSpawner bossGroupHealNovaSpawner = default(BossGroupHealNovaSpawner);
			if (Object.op_Implicit((Object)(object)((EntityState)this).transform.parent) && ((Component)((EntityState)this).transform.parent).TryGetComponent<BossGroupHealNovaSpawner>(ref bossGroupHealNovaSpawner))
			{
				_radius = bossGroupHealNovaSpawner.NovaRadius;
			}
			TeamFilter component = ((EntityState)this).GetComponent<TeamFilter>();
			TeamIndex teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)component)) ? (-1) : ((int)component.teamIndex));
			if (NetworkServer.active)
			{
				_healPulse = new HealPulse(((EntityState)this).transform.position, _radius, 0.5f, GrowDuration, teamIndex);
			}
			_effectTransform = ((EntityState)this).transform.Find("PulseEffect");
			if (Object.op_Implicit((Object)(object)_effectTransform))
			{
				((Component)_effectTransform).gameObject.SetActive(true);
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)_effectTransform))
			{
				((Component)_effectTransform).gameObject.SetActive(false);
			}
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active)
			{
				_healPulse.Update(((EntityState)this).GetDeltaTime());
				if (((EntityState)this).fixedAge >= _totalDuration)
				{
					EntityState.Destroy((Object)(object)((Component)base.outer).gameObject);
				}
			}
		}

		public override void Update()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_effectTransform))
			{
				float num = _radius * NovaRadiusCurve.Evaluate(Mathf.Clamp01(((EntityState)this).fixedAge / GrowDuration));
				_effectTransform.localScale = new Vector3(num, num, num);
			}
		}
	}
	public class BossGroupHealNovaWindup : EntityState
	{
		private static EffectIndex _chargeEffectIndex = (EffectIndex)(-1);

		public static float Duration;

		[SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })]
		private static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			_chargeEffectIndex = EffectCatalogUtils.FindEffectIndex("ChargeTPHealingNova");
			if ((int)_chargeEffectIndex == -1)
			{
				Log.Warning("Failed to find charge effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\BossGroupHealNovaController\\BossGroupHealNovaWindup.cs", "Init", 16);
			}
		}

		public override void OnEnter()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_002f: Expected O, but got Unknown
			((EntityState)this).OnEnter();
			if ((int)_chargeEffectIndex != -1)
			{
				EffectManager.SpawnEffect(_chargeEffectIndex, new EffectData
				{
					origin = ((EntityState)this).transform.position
				}, false);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration)
			{
				base.outer.SetNextStateToMain();
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	internal static class IsExternalInit
	{
	}
}
namespace ItemQualities
{
	internal static class AnimationEffectSetExplosionScalePatch
	{
		private const int ExplosionInfoBitOffset = 8;

		private const int ExplosionInfoBitMask = 65280;

		public static void SetEncodedExplosionIndex(AnimationEvent evnt, ExplosionInfoIndex explosionInfoIndex)
		{
			evnt.intParameter = EncodeExplosionIndex(evnt.intParameter, explosionInfoIndex);
		}

		public static int EncodeExplosionIndex(int intParameter, ExplosionInfoIndex explosionInfoIndex)
		{
			if (explosionInfoIndex >= (ExplosionInfoIndex)255)
			{
				Log.Error($"Cannot encode explosion index larger than 255 ({explosionInfoIndex})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "EncodeExplosionIndex", 26);
				return intParameter;
			}
			return (intParameter & -65281) | (((int)(explosionInfoIndex + 1) << 8) & 0xFF00);
		}

		public static ExplosionInfoIndex GetExplosionIndex(AnimationEvent evnt)
		{
			int intParameter = evnt.intParameter;
			DecodeExplosionIndex(ref intParameter, out var explosionInfoIndex);
			evnt.intParameter = intParameter;
			return explosionInfoIndex;
		}

		public static void DecodeExplosionIndex(ref int intParameter, out ExplosionInfoIndex explosionInfoIndex)
		{
			explosionInfoIndex = (ExplosionInfoIndex)(((intParameter & 0xFF00) >> 8) - 1);
			if (explosionInfoIndex < ExplosionInfoIndex.None || (int)explosionInfoIndex > ExplosionInfoCatalog.ExplosionInfoDefCount)
			{
				Log.Error($"Out of bounds explosion index encoded in intParameter, likely data overlap (param={intParameter}, explosionIndex={explosionInfoIndex})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "DecodeExplosionIndex", 47);
				explosionInfoIndex = ExplosionInfoIndex.None;
			}
			intParameter &= -65281;
		}

		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			AnimationEvents.CreateEffect += new Manipulator(AnimationEvents_CreateEffect);
		}

		private static void AnimationEvents_CreateEffect(ILContext il)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			if (!((MethodReference)(object)il.Method).TryFindParameter<AnimationEvent>(out var parameter))
			{
				Log.Error("Failed to find AnimationEvent parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "AnimationEvents_CreateEffect", 64);
				return;
			}
			ILCursor val = new ILCursor(il);
			VariableDefinition val2 = il.AddVariable<ExplosionInfoIndex>();
			val.Emit(OpCodes.Ldarg, parameter);
			val.EmitDelegate<Func<AnimationEvent, ExplosionInfoIndex>>((Func<AnimationEvent, ExplosionInfoIndex>)GetExplosionIndex);
			val.Emit(OpCodes.Stloc, val2);
			int effectDataLocalIndex = -1;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchNewobj<EffectData>(x),
				(Instruction x) => x.MatchStloc(typeof(EffectData), il, out effectDataLocalIndex)
			}))
			{
				Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "AnimationEvents_CreateEffect", 81);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldloc, effectDataLocalIndex);
			val.Emit(OpCodes.Ldloc, val2);
			val.EmitDelegate<Action<AnimationEvents, EffectData, ExplosionInfoIndex>>((Action<AnimationEvents, EffectData, ExplosionInfoIndex>)tryApplyExplosionScale);
			static void tryApplyExplosionScale(AnimationEvents self, EffectData effectData, ExplosionInfoIndex explosionInfoIndex)
			{
				if (explosionInfoIndex != ExplosionInfoIndex.None)
				{
					float defaultRange = ExplosionInfoCatalog.GetExplosionInfoDef(explosionInfoIndex).GetDefaultRange();
					GameObject val3 = (Object.op_Implicit((Object)(object)self) ? self.bodyObject : null);
					CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent<CharacterBody>() : null);
					effectData.scale = (Object.op_Implicit((Object)(object)val4) ? ExplodeOnDeath.GetExplosionRadius(defaultRange, val4) : defaultRange);
				}
			}
		}
	}
	internal static class AnimationPrefabSetOwnershipPatch
	{
		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			AnimationEvents.CreatePrefab += new Manipulator(AnimationEvents_CreatePrefab);
		}

		private static void AnimationEvents_CreatePrefab(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = 0;
			MethodReference val2 = default(MethodReference);
			while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) && val2 != null && ((MemberReference)val2).Name?.StartsWith("<CreatePrefab>g__DoSpawnEffect|") == true
			}))
			{
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<Transform, AnimationEvents>>((Action<Transform, AnimationEvents>)onPrefabSpawned);
				num++;
			}
			if (num == 0)
			{
				Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationPrefabSetOwnershipPatch.cs", "AnimationEvents_CreatePrefab", 58);
			}
			static void onPrefabSpawned(Transform prefabTransform, AnimationEvents animationEvents)
			{
				LocalEffectOwnership localEffectOwnership = default(LocalEffectOwnership);
				if (Object.op_Implicit((Object)(object)prefabTransform) && ((Component)prefabTransform).TryGetComponent<LocalEffectOwnership>(ref localEffectOwnership))
				{
					GameObject ownerObject = (Object.op_Implicit((Object)(object)animationEvents.bodyObject) ? animationEvents.bodyObject : ((!Object.op_Implicit((Object)(object)animationEvents.entityLocator)) ? ((Component)animationEvents).gameObject : animationEvents.entityLocator.entity));
					localEffectOwnership.OwnerObject = ownerObject;
				}
			}
		}
	}
	[DefaultExecutionOrder(-1000)]
	public class AssignAddressableReferences : MonoBehaviour, IAsyncContentLoadCallback
	{
		[Serializable]
		public class ComponentFieldAddressableAssignment
		{
			[Tooltip("The object to assign the field on")]
			[SerializeField]
			[FormerlySerializedAs("TargetObject")]
			private Object _targetObject;

			[SerializeField]
			[HideInInspector]
			private Component _targetObjectComponent;

			[Tooltip("If set, the first component of this type will be located on the Target Object and used as the field instance")]
			[RequiredBaseType(typeof(Component))]
			public SerializableSystemType TargetObjectComponentType;

			[Tooltip("The name of the field or property to set")]
			public string FieldName;

			[Tooltip("Address of the asset to load")]
			public AssetReferenceT<Object> AssetReference = new AssetReferenceT<Object>(string.Empty);

			[Tooltip("Determines what type is used to load the asset, if not set, the type of the field/property is used")]
			[RequiredBaseType(typeof(Object))]
			public SerializableSystemType AssetTypeOverride;

			public Object TargetObject
			{
				get
				{
					if (!Object.op_Implicit((Object)(object)_targetObjectComponent))
					{
						return _targetObject;
					}
					return (Object)(object)_targetObjectComponent;
				}
			}

			public void OnValidate()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				_targetObjectComponent = null;
				Type type = (Type)TargetObjectComponentType;
				if (!(type != null) || !Object.op_Implicit(_targetObject))
				{
					return;
				}
				Object targetObject = _targetObject;
				GameObject val = (GameObject)(object)((targetObject is GameObject) ? targetObject : null);
				if (val == null)
				{
					Component val2 = (Component)(object)((targetObject is Component) ? targetObject : null);
					if (val2 != null)
					{
						_targetObjectComponent = val2.GetComponent(type);
					}
				}
				else
				{
					_targetObjectComponent = val.GetComponent(type);
				}
			}
		}

		public ComponentFieldAddressableAssignment[] FieldAssignments = Array.Empty<ComponentFieldAddressableAssignment>();

		[SerializeField]
		[HideInInspector]
		private bool _hasLoaded;

		public bool HasLoaded => _hasLoaded;

		private void Awake()
		{
			if (!_hasLoaded)
			{
				Log.Warning(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + ": Addressable references were not assigned to prefab during init, loading assets now", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AssignAddressableReferences.cs", "Awake", 32);
				IEnumerator enumerator = AssignFieldsAsync();
				while (enumerator.MoveNext())
				{
				}
			}
		}

		IEnumerator IAsyncContentLoadCallback.OnContentLoad(IProgress<float> progressReceiver)
		{
			return AssignFieldsAsync(progressReceiver);
		}

		public IEnumerator AssignFieldsAsync(IProgress<float> progressReceiver = null)
		{
			if (FieldAssignments.Length != 0)
			{
				if (progressReceiver != null)
				{
					ParallelProgressCoroutine val = new ParallelProgressCoroutine(progressReceiver);
					ComponentFieldAddressableAssignment[] fieldAssignments = FieldAssignments;
					foreach (ComponentFieldAddressableAssignment componentFieldAssignment in fieldAssignments)
					{
						ReadableProgress<float> val2 = new ReadableProgress<float>();
						val.Add(assignComponentFieldAsync(componentFieldAssignment, (IProgress<float>)val2), val2);
					}
					yield return val;
				}
				else
				{
					ParallelCoroutine val3 = new ParallelCoroutine();
					ComponentFieldAddressableAssignment[] fieldAssignments = FieldAssignments;
					foreach (ComponentFieldAddressableAssignment componentFieldAssignment2 in fieldAssignments)
					{
						val3.Add(assignComponentFieldAsync(componentFieldAssignment2));
					}
					yield return val3;
				}
			}
			_hasLoaded = true;
			((Behaviour)this).enabled = false;
		}

		private IEnumerator assignComponentFieldAsync(ComponentFieldAddressableAssignment componentFieldAssignment, IProgress<float> progressReceiver = null)
		{
			if (!Object.op_Implicit(componentFieldAssignment.TargetObject))
			{
				yield break;
			}
			Type type = ((object)componentFieldAssignment.TargetObject).GetType();
			Type memberType;
			MemberInfo targetMember = findTargetMember(type, componentFieldAssignment.FieldName, out memberType);
			if (targetMember == null)
			{
				Log.Error($"Failed to find field '{componentFieldAssignment.FieldName}' on component {componentFieldAssignment.TargetObject}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AssignAddressableReferences.cs", "assignComponentFieldAsync", 87);
				yield break;
			}
			Type assetType = ((Type)componentFieldAssignment.AssetTypeOverride) ?? memberType;
			AsyncOperationHandle assetLoadHandle = AddressableUtil.LoadAssetAsync((AssetReference)(object)componentFieldAssignment.AssetReference, assetType, (AsyncReferenceHandleUnloadType)2);
			try
			{
				yield return assetLoadHandle.AsProgressCoroutine(progressReceiver);
				AssignAddressableReferences assignAddressableReferences = this;
				object result = ((AsyncOperationHandle)(ref assetLoadHandle)).Result;
				assignAddressableReferences.applyFieldValue(componentFieldAssignment, targetMember, (Object)((result is Object) ? result : null));
			}
			finally
			{
				AddressableUtil.UnloadAsset((AssetReference)(object)componentFieldAssignment.AssetReference, assetType);
			}
		}

		private void applyFieldValue(ComponentFieldAddressableAssignment componentFieldAssignment, MemberInfo member, Object value)
		{
			Type type = ((object)componentFieldAssignment.TargetObject).GetType();
			object runtimeKey = ((AssetReference)componentFieldAssignment.AssetReference).RuntimeKey;
			if (!Object.op_Implicit(value))
			{
				Log.Warning($"{Util.GetGameObjectHierarchyName(((Component)this).gameObject)} ({type.FullName}.{componentFieldAssignment.FieldName}): Null asset loaded for asset {runtimeKey}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AssignAddressableReferences.cs", "applyFieldValue", 113);
			}
			try
			{
				if (!(member is FieldInfo fieldInfo))
				{
					if (member is PropertyInfo propertyInfo)
					{
						propertyInfo.SetValue(componentFieldAssignment.TargetObject, value);
					}
				}
				else
				{
					fieldInfo.SetValue(componentFieldAssignment.TargetObject, value);
				}
			}
			catch (Exception ex)
			{
				Log.Error_NoCallerPrefix($"{Util.GetGameObjectHierarchyName(((Component)this).gameObject)}: Failed to set field {type.FullName}.{componentFieldAssignment.FieldName} to asset {value} from {runtimeKey}: {ex}");
			}
		}

		private void OnValidate()
		{
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			ComponentFieldAddressableAssignment[] fieldAssignments = FieldAssignments;
			foreach (ComponentFieldAddressableAssignment componentFieldAddressableAssignment in fieldAssignments)
			{
				componentFieldAddressableAssignment.OnValidate();
				if (!Object.op_Implicit(componentFieldAddressableAssignment.TargetObject))
				{
					continue;
				}
				Type type = ((object)componentFieldAddressableAssignment.TargetObject).GetType();
				if (findTargetMember(type, componentFieldAddressableAssignment.FieldName, out var memberType) == null)
				{
					Debug.LogWarning((object)("Field or property '" + componentFieldAddressableAssignment.FieldName + "' does not exist in type " + type.FullName), (Object)(object)this);
					continue;
				}
				if (!typeof(Object).IsAssignableFrom(memberType))
				{
					Debug.LogWarning((object)("Invalid type " + memberType.FullName + " on field " + type.FullName + "." + componentFieldAddressableAssignment.FieldName + " (must be UnityEngine.Object)"), (Object)(object)this);
				}
				Type type2 = (Type)componentFieldAddressableAssignment.AssetTypeOverride;
				if (type2 != null && !memberType.IsAssignableFrom(type2))
				{
					Debug.LogWarning((object)("Asset type " + type2.FullName + " cannot be assigned to field of type " + memberType.FullName + " (" + type.FullName + "." + componentFieldAddressableAssignment.FieldName + ")"), (Object)(object)this);
				}
			}
		}

		private static MemberInfo findTargetMember(Type componentType, string fieldName, out Type memberType)
		{
			FieldInfo field = componentType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field != null)
			{
				memberType = field.FieldType;
				return field;
			}
			PropertyInfo property = componentType.GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (property != null)
			{
				memberType = property.PropertyType;
				return property;
			}
			memberType = null;
			return null;
		}
	}
	internal static class AttackCollisionHooks
	{
		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			BulletAttack.DefaultFilterCallbackImplementation += new hook_DefaultFilterCallbackImplementation(BulletAttack_DefaultFilterCallbackImplementation);
			OverlapAttack.HurtBoxPassesFilter += new hook_HurtBoxPassesFilter(OverlapAttack_HurtBoxPassesFilter);
			BlastAttack.CollectHits += new Manipulator(BlastAttack_CollectHits);
		}

		private static bool BulletAttack_DefaultFilterCallbackImplementation(orig_DefaultFilterCallbackImplementation orig, BulletAttack bulletAttack, ref BulletHit hitInfo)
		{
			if (!orig.Invoke(bulletAttack, ref hitInfo))
			{
				return false;
			}
			try
			{
				if (Object.op_Implicit((Object)(object)bulletAttack.owner) && bulletAttack.owner.TryGetComponentCached<ObjectCollisionManager>(out ObjectCollisionManager component) && component.IgnoresCollisionsWith(hitInfo.collider))
				{
					return false;
				}
			}
			catch (Exception data)
			{
				Log.Error_NoCallerPrefix(data);
			}
			return true;
		}

		private static bool OverlapAttack_HurtBoxPassesFilter(orig_HurtBoxPassesFilter orig, OverlapAttack self, HurtBox hurtBox)
		{
			if (!orig.Invoke(self, hurtBox))
			{
				return false;
			}
			try
			{
				if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)self.attacker) && self.attacker.TryGetComponentCached<ObjectCollisionManager>(out ObjectCollisionManager component) && component.IgnoresCollisionsWith(hurtBox.collider))
				{
					return false;
				}
			}
			catch (Exception data)
			{
				Log.Error_NoCallerPrefix(data);
			}
			return true;
		}

		private static void BlastAttack_CollectHits(ILContext il)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int hurtBoxVarIndex = -1;
			ILLabel hurtBoxInvalidLabel = null;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => x.MatchLdloc(typeof(HurtBox), il, out hurtBoxVarIndex),
				(Instruction x) => x.MatchImplicitConversion<Object, bool>(),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref hurtBoxInvalidLabel)
			}))
			{
				Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AttackCollisionHooks.cs", "BlastAttack_CollectHits", 72);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldloc, hurtBoxVarIndex);
			val.EmitDelegate<Func<BlastAttack, HurtBox, bool>>((Func<BlastAttack, HurtBox, bool>)attackerIgnoresCollisionWith);
			val.Emit(OpCodes.Brtrue, (object)hurtBoxInvalidLabel);
			static bool attackerIgnoresCollisionWith(BlastAttack blastAttack, HurtBox hurtBox)
			{
				if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.collider) && blastAttack != null && Object.op_Implicit((Object)(object)blastAttack.attacker) && blastAttack.attacker.TryGetComponentCached<ObjectCollisionManager>(out ObjectCollisionManager component) && component.IgnoresCollisionsWith(hurtBox.collider))
				{
					return true;
				}
				return false;
			}
		}
	}
	public class AxisBillboard : MonoBehaviour
	{
		public Vector3 Axis = Vector3.up;

		private void OnEnable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			SceneCamera.onSceneCameraPreCull += new SceneCameraDelegate(onSceneCameraPreCull);
		}

		private void OnDisable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			SceneCamera.onSceneCameraPreCull -= new SceneCameraDelegate(onSceneCameraPreCull);
		}

		private void onSceneCameraPreCull(SceneCamera sceneCamera)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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)
			Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.position, Axis);
			Vector3 val2 = Vector3.ProjectOnPlane(((Component)sceneCamera).transform.position, Axis);
			Transform transform = ((Component)this).transform;
			Vector3 val3 = val2 - val;
			transform.rotation = Util.QuaternionSafeLookRotation(((Vector3)(ref val3)).normalized);
		}
	}
	public sealed class BarrierPickup : MonoBehaviour
	{
		[Tooltip("The base object to destroy when this pickup is consumed.")]
		public GameObject BaseObject;

		[Tooltip("The team filter object which determines who can pick up this pack.")]
		public TeamFilter TeamFilter;

		public GameObject PickupEffect;

		public float FlatAmount;

		public float FractionalAmount;

		private bool _alive = true;

		private void OnTriggerStay(Collider other)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			if (!NetworkServer.active || !_alive || TeamComponent.GetObjectTeam(((Component)other).gameObject) != TeamFilter.teamIndex)
			{
				return;
			}
			CharacterBody component = ((Component)other).GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			HealthComponent healthComponent = component.healthComponent;
			if (Object.op_Implicit((Object)(object)healthComponent))
			{
				healthComponent.AddBarrier(FlatAmount + healthComponent.fullBarrier * FractionalAmount);
				if (Object.op_Implicit((Object)(object)PickupEffect))
				{
					EffectManager.SpawnEffect(PickupEffect, new EffectData
					{
						origin = ((Component)this).transform.position
					}, true);
				}
			}
			Object.Destroy((Object)(object)BaseObject);
			_alive = false;
		}
	}
	[RequireComponent(typeof(NetworkedBodyAttachment))]
	public class BodyAttachmentVFXController : MonoBehaviour, INetworkedBodyAttachmentListener
	{
		public enum RadiusMode
		{
			Constant,
			BodyRadius,
			BodyBestFitRadius,
			BodyBestFitActualRadius
		}

		[SerializeField]
		private InstantiateAddressablePrefab _bodyVFXInstantiator;

		[SerializeField]
		private RadiusMode _radiusMode = RadiusMode.BodyRadius;

		[SerializeField]
		[Min(0f)]
		private float _radiusMultiplier = 1f;

		private NetworkedBodyAttachment _bodyAttachment;

		private void Awake()
		{
			_bodyAttachment = ((Component)this).GetComponent<NetworkedBodyAttachment>();
			_bodyVFXInstantiator.OnInstantiated += onVFXInstantiated;
		}

		private void OnDestroy()
		{
			_bodyVFXInstantiator.OnInstantiated -= onVFXInstantiated;
		}

		private void onVFXInstantiated(GameObject vfx)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			TemporaryVisualEffect val = default(TemporaryVisualEffect);
			if (!vfx.TryGetComponent<TemporaryVisualEffect>(ref val))
			{
				return;
			}
			CharacterBody attachedBody = _bodyAttachment.attachedBody;
			if (Object.op_Implicit((Object)(object)attachedBody))
			{
				float num = _radiusMode switch
				{
					RadiusMode.Constant => 1f, 
					RadiusMode.BodyRadius => attachedBody.radius, 
					RadiusMode.BodyBestFitRadius => attachedBody.bestFitRadius, 
					RadiusMode.BodyBestFitActualRadius => attachedBody.bestFitActualRadius, 
					_ => throw new NotImplementedException($"Radius mode {_radiusMode} is not implemented"), 
				};
				val.parentTransform = attachedBody.coreTransform;
				val.visualState = (VisualState)0;
				val.healthComponent = attachedBody.healthComponent;
				val.radius = num * _radiusMultiplier;
				LocalCameraEffect val2 = default(LocalCameraEffect);
				if (((Component)val).TryGetComponent<LocalCameraEffect>(ref val2))
				{
					val2.targetCharacter = ((Component)attachedBody).gameObject;
				}
			}
		}

		void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody)
		{
			_bodyVFXInstantiator.InstantiatePrefab();
		}
	}
	public sealed class BossArenaHealNovaManager : MonoBehaviour
	{
		public BossGroup WatchingBossGroup;

		public float ArenaRadius = 100f;

		private readonly GameObject[] _healNovaSpawnersByTeam = (GameObject[])(object)new GameObject[TeamsAPICompat.TeamsCount];

		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			GridManager.OnTierSet += new hook_OnTierSet(GridManager_OnTierSet);
		}

		private static void GridManager_OnTierSet(orig_OnTierSet orig, GridManager self, int tier)
		{
			//IL_0022: 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_002c: 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)
			orig.Invoke(self, tier);
			try
			{
				foreach (BossArenaHealNovaManager instances in InstanceTracker.GetInstancesList<BossArenaHealNovaManager>())
				{
					Vector3 position = ((Component)instances).transform.position;
					position.y = self.GetLavaPosition(tier).y;
					instances.setPosition(position);
				}
			}
			catch (Exception data)
			{
				Log.Error_NoCallerPrefix(data);
			}
		}

		private void Awake()
		{
			if (!NetworkServer.active)
			{
				Log.Warning("Created on server", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BossArenaHealNovaManager.cs", "Awake", 49);
				((Behaviour)this).enabled = false;
			}
		}

		private void Start()
		{
			if (Object.op_Implicit((Object)(object)WatchingBossGroup))
			{
				updateAllTeamHealNovaManagers();
			}
		}

		private void OnEnable()
		{
			InstanceTracker.Add<BossArenaHealNovaManager>(this);
			if (Object.op_Implicit((Object)(object)WatchingBossGroup))
			{
				updateAllTeamHealNovaManagers();
			}
			Inventory.onInventoryChangedGlobal += onInventoryChangedGlobal;
			BossGroup.onBossGroupDefeatedServer += onBossGroupDefeatedServer;
		}

		private void OnDisable()
		{
			InstanceTracker.Remove<BossArenaHealNovaManager>(this);
			GameObject[] healNovaSpawnersByTeam = _healNovaSpawnersByTeam;
			foreach (GameObject val in healNovaSpawnersByTeam)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					Object.Destroy((Object)(object)val);
				}
			}
			Inventory.onInventoryChangedGlobal -= onInventoryChangedGlobal;
			BossGroup.onBossGroupDefeatedServer -= onBossGroupDefeatedServer;
		}

		private void onBossGroupDefeatedServer(BossGroup bossGroup)
		{
			if ((Object)(object)bossGroup == (Object)(object)WatchingBossGroup)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void onInventoryChangedGlobal(Inventory inventory)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			CharacterMaster val = default(CharacterMaster);
			if (((Component)inventory).TryGetComponent<CharacterMaster>(ref val) && (int)val.teamIndex != -1)
			{
				updateTeamHealNovaManager(val.teamIndex);
			}
		}

		private void updateAllTeamHealNovaManagers()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			TeamIndex val = (TeamIndex)0;
			while ((int)val < TeamsAPICompat.TeamsCount)
			{
				updateTeamHealNovaManager(val);
				val = (TeamIndex)(sbyte)(val + 1);
			}
		}

		private void updateTeamHealNovaManager(TeamIndex teamIndex)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected I4, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (!ArrayUtils.IsInBounds<GameObject>(_healNovaSpawnersByTeam, (int)teamIndex))
			{
				Log.Warning($"TeamIndex {teamIndex} is not in bounds of heal nova spawners array", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BossArenaHealNovaManager.cs", "updateTeamHealNovaManager", 122);
				return;
			}
			bool flag = ItemQualityUtils.GetTeamItemCounts(ItemQualitiesContent.ItemQualityGroups.TPHealingNova, teamIndex, requireAlive: true).TotalQualityCount > 0;
			ref GameObject reference = ref _healNovaSpawnersByTeam[teamIndex];
			if (Object.op_Implicit((Object)(object)reference) != flag)
			{
				if (flag)
				{
					reference = Object.Instantiate<GameObject>(ItemQualitiesContent.NetworkedPrefabs.BossArenaHealNovaSpawner, ((Component)this).transform.position, ((Component)this).transform.rotation);
					reference.GetComponent<TeamFilter>().teamIndex = teamIndex;
					BossGroupHealNovaSpawner component = reference.GetComponent<BossGroupHealNovaSpawner>();
					component.BossGroup = WatchingBossGroup;
					component.NetworkNovaRadius = ArenaRadius;
					NetworkServer.Spawn(reference);
				}
				else
				{
					Object.Destroy((Object)(object)reference);
					reference = null;
				}
			}
		}

		private void setPosition(Vector3 arenaCenter)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = arenaCenter;
			GameObject[] healNovaSpawnersByTeam = _healNovaSpawnersByTeam;
			BossGroupHealNovaSpawner bossGroupHealNovaSpawner = default(BossGroupHealNovaSpawner);
			foreach (GameObject val in healNovaSpawnersByTeam)
			{
				if (Object.op_Implicit((Object)(object)val) && val.TryGetComponent<BossGroupHealNovaSpawner>(ref bossGroupHealNovaSpawner))
				{
					bossGroupHealNovaSpawner.SetPositionServer(arenaCenter);
				}
			}
			TeamIndex val2 = (TeamIndex)0;
			while ((int)val2 < TeamsAPICompat.TeamsCount)
			{
				GameObject val3 = _healNovaSpawnersByTeam[val2];
				if (Object.op_Implicit((Object)(object)val3))
				{
					val3.transform.position = ((Component)this).transform.position;
				}
				val2 = (TeamIndex)(sbyte)(val2 + 1);
			}
		}
	}
	[RequireComponent(typeof(TeamFilter))]
	public sealed class BossGroupHealNovaSpawner : NetworkBehaviour
	{
		private static GameObject _pulsePrefab;

		public BossGroup BossGroup;

		public float MinSecondsBetweenPulses = 1f;

		[SyncVar]
		public float NovaRadius = 100f;

		private TeamFilter _teamFilter;

		private float _lastPulseFraction;

		private float _pulseAvailableTimer;

		private static int kRpcRpcSetPosition;

		public float NetworkNovaRadius
		{
			get
			{
				return NovaRadius;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<float>(value, ref NovaRadius, 1u);
			}
		}

		[ContentInitializer]
		private static IEnumerator LoadContent(ContentIntializerArgs args)
		{
			//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)
			AsyncOperationHandle<GameObject> val = AddressableUtil.LoadTempAssetAsync<GameObject>(RoR2_Base_TPHealingNova.TeleporterHealNovaPulse_prefab);
			val.OnSuccess(delegate(GameObject novaPulse)
			{
				//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_0039: 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)
				_pulsePrefab = PrefabAPI.InstantiateClone(novaPulse, "BossGroupHealNovaPulse");
				EntityStateMachine component = _pulsePrefab.GetComponent<EntityStateMachine>();
				component.initialStateType = new SerializableEntityStateType(typeof(BossGroupHealNovaWindup));
				component.mainStateType = new SerializableEntityStateType(typeof(BossGroupHealNovaPulse));
				args.ContentPack.networkedObjectPrefabs.Add<GameObject>(_pulsePrefab);
			});
			return val.AsProgressCoroutine<GameObject>(args.ProgressReceiver);
		}

		private void Awake()
		{
			_teamFilter = ((Component)this).GetComponent<TeamFilter>();
		}

		private void Start()
		{
			if (NetworkServer.active)
			{
				_lastPulseFraction = getCurrentBossProgressFraction();
			}
		}

		private void OnDisable()
		{
			((Component)this).transform.DetachChildren();
		}

		private void FixedUpdate()
		{
			if (NetworkServer.active)
			{
				fixedUpdateServer(Time.fixedDeltaTime);
			}
		}

		private void fixedUpdateServer(float deltaTime)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (_pulseAvailableTimer > 0f)
			{
				_pulseAvailableTimer -= deltaTime;
				return;
			}
			ItemQualityCounts teamItemCounts = ItemQualityUtils.GetTeamItemCounts(ItemQualitiesContent.ItemQualityGroups.TPHealingNova, _teamFilter.teamIndex, requireAlive: true);
			float nextPulseFraction = getNextPulseFraction(teamItemCounts.UncommonCount + 2 * teamItemCounts.RareCount + 3 * teamItemCounts.EpicCount + 5 * teamItemCounts.LegendaryCount, _lastPulseFraction);
			if (getCurrentBossProgressFraction() > nextPulseFraction)
			{
				spawnPulse();
				_lastPulseFraction = nextPulseFraction;
				_pulseAvailableTimer = MinSecondsBetweenPulses;
			}
		}

		private float getCurrentBossProgressFraction()
		{
			if (!Object.op_Implicit((Object)(object)BossGroup) || !Object.op_Implicit((Object)(object)BossGroup.combatSquad))
			{
				return 0f;
			}
			if (BossGroup.combatSquad.defeatedServer)
			{
				return 1f;
			}
			float totalMaxObservedMaxHealth = BossGroup.totalMaxObservedMaxHealth;
			float totalObservedHealth = BossGroup.totalObservedHealth;
			float num = ((totalMaxObservedMaxHealth > 0f) ? Mathf.Clamp01(totalObservedHealth / totalMaxObservedMaxHealth) : 1f);
			return 1f - num;
		}

		private static float getNextPulseFraction(int pulseCount, float lastPulseFraction)
		{
			float num = 1f / (float)(pulseCount + 1);
			for (int i = 0; i < pulseCount; i++)
			{
				float num2 = num * (float)(i + 1);
				if (num2 > lastPulseFraction)
				{
					return num2;
				}
			}
			return 1f;
		}

		private void spawnPulse()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(_pulsePrefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform);
			obj.GetComponent<TeamFilter>().teamIndex = _teamFilter.teamIndex;
			NetworkServer.Spawn(obj);
		}

		[Server]
		public void SetPositionServer(Vector3 position)
		{
			//IL_001b: 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)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.BossGroupHealNovaSpawner::SetPositionServer(UnityEngine.Vector3)' called on client");
				return;
			}
			((Component)this).transform.position = position;
			CallRpcSetPosition(position);
		}

		[ClientRpc]
		private void RpcSetPosition(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = position;
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeRpcRpcSetPosition(NetworkBehaviour obj, NetworkReader reader)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcSetPosition called on server.");
			}
			else
			{
				((BossGroupHealNovaSpawner)(object)obj).RpcSetPosition(reader.ReadVector3());
			}
		}

		public void CallRpcSetPosition(Vector3 position)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"RPC Function RpcSetPosition called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcSetPosition);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			val.Write(position);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSetPosition");
		}

		static BossGroupHealNovaSpawner()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			kRpcRpcSetPosition = -351386061;
			NetworkBehaviour.RegisterRpcDelegate(typeof(BossGroupHealNovaSpawner), kRpcRpcSetPosition, new CmdDelegate(InvokeRpcRpcSetPosition));
			NetworkCRC.RegisterBehaviour("BossGroupHealNovaSpawner", 0);
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			if (forceAll)
			{
				writer.Write(NovaRadius);
				return true;
			}
			bool flag = false;
			if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.Write(NovaRadius);
			}
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
			}
			return flag;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			if (initialState)
			{
				NovaRadius = reader.ReadSingle();
				return;
			}
			int num = (int)reader.ReadPackedUInt32();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				NovaRadius = reader.ReadSingle();
			}
		}

		public override void PreStartClient()
		{
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	public struct BuffQualityCounts : IEquatable<BuffQualityCounts>
	{
		[FieldOffset(0)]
		private unsafe fixed int _buffCounts[5];

		[FieldOffset(0)]
		public int BaseCount;

		[FieldOffset(4)]
		public int UncommonCount;

		[FieldOffset(8)]
		public int RareCount;

		[FieldOffset(12)]
		public int EpicCount;

		[FieldOffset(16)]
		public int LegendaryCount;

		public readonly int TotalCount => BaseCount + UncommonCount + RareCount + EpicCount + LegendaryCount;

		public readonly int TotalQualityCount => UncommonCount + RareCount + EpicCount + LegendaryCount;

		public unsafe ref int this[QualityTier qualityTier] => ref _buffCounts[(int)(qualityTier + 1)];

		public unsafe readonly QualityTier HighestQuality
		{
			get
			{
				for (QualityTier qualityTier = QualityTier.Legendary; qualityTier >= QualityTier.Uncommon; qualityTier--)
				{
					if (_buffCounts[(int)(qualityTier + 1)] > 0)
					{
						return qualityTier;
					}
				}
				return QualityTier.None;
			}
		}

		public BuffQualityCounts(int baseCount, int uncommonCount, int rareCount, int epicCount, int legendaryCount)
		{
			BaseCount = Math.Max(0, baseCount);
			UncommonCount = Math.Max(0, uncommonCount);
			RareCount = Math.Max(0, rareCount);
			EpicCount = Math.Max(0, epicCount);
			LegendaryCount = Math.Max(0, legendaryCount);
		}

		public override readonly bool Equals(object obj)
		{
			if (obj is BuffQualityCounts other)
			{
				return Equals(in other);
			}
			return false;
		}

		readonly bool IEquatable<BuffQualityCounts>.Equals(BuffQualityCounts other)
		{
			return Equals(in other);
		}

		public readonly bool Equals(in BuffQualityCounts other)
		{
			if (BaseCount == other.BaseCount && UncommonCount == other.UncommonCount && RareCount == other.RareCount && EpicCount == other.EpicCount)
			{
				return LegendaryCount == other.LegendaryCount;
			}
			return false;
		}

		public override readonly int GetHashCode()
		{
			return HashCode.Combine(BaseCount, UncommonCount, RareCount, EpicCount, LegendaryCount);
		}

		public override readonly string ToString()
		{
			return $"Normal={BaseCount}, Uncommon={UncommonCount}, Rare={RareCount}, Epic={EpicCount}, Legendary={LegendaryCount}";
		}

		public static bool operator ==(in BuffQualityCounts left, in BuffQualityCounts right)
		{
			return left.Equals(in right);
		}

		public static bool operator !=(in BuffQualityCounts left, in BuffQualityCounts right)
		{
			return !left.Equals(in right);
		}

		public static BuffQualityCounts operator +(in BuffQualityCounts left, in BuffQualityCounts right)
		{
			return new BuffQualityCounts(left.BaseCount + right.BaseCount, left.UncommonCount + right.UncommonCount, left.RareCount + right.RareCount, left.EpicCount + right.EpicCount, left.LegendaryCount + right.LegendaryCount);
		}

		public static BuffQualityCounts operator -(in BuffQualityCounts left, in BuffQualityCounts right)
		{
			return new BuffQualityCounts(left.BaseCount - right.BaseCount, left.UncommonCount - right.UncommonCount, left.RareCount - right.RareCount, left.EpicCount - right.EpicCount, left.LegendaryCount - right.LegendaryCount);
		}
	}
	[CreateAssetMenu(menuName = "ItemQualities/Buffs/BuffQualityGroup")]
	public sealed class BuffQualityGroup : ScriptableObject, IAsyncContentLoadCallback
	{
		[NonSerialized]
		[HideInInspector]
		public BuffQualityGroupIndex GroupIndex = BuffQualityGroupIndex.Invalid;

		[SerializeField]
		internal AssetReferenceT<BuffDef> BaseBuffReference = new AssetReferenceT<BuffDef>(string.Empty);

		[SerializeField]
		internal BuffDef BaseBuff;

		[SerializeField]
		private BuffDef _uncommonBuff;

		[SerializeField]
		private BuffDef _rareBuff;

		[SerializeField]
		private BuffDef _epicBuff;

		[SerializeField]
		private BuffDef _legendaryBuff;

		[NonSerialized]
		[HideInInspector]
		public BuffIndex BaseBuffIndex = (BuffIndex)(-1);

		public BuffIndex UncommonBuffIndex
		{
			get
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_uncommonBuff))
				{
					return (BuffIndex)(-1);
				}
				return _uncommonBuff.buffIndex;
			}
		}

		public BuffIndex RareBuffIndex
		{
			get
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_rareBuff))
				{
					return (BuffIndex)(-1);
				}
				return _rareBuff.buffIndex;
			}
		}

		public BuffIndex EpicBuffIndex
		{
			get
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_epicBuff))
				{
					return (BuffIndex)(-1);
				}
				return _epicBuff.buffIndex;
			}
		}

		public BuffIndex LegendaryBuffIndex
		{
			get
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_legendaryBuff))
				{
					return (BuffIndex)(-1);
				}
				return _legendaryBuff.buffIndex;
			}
		}

		private bool checkCanModify()
		{
			if (((ResourceAvailability)(ref QualityCatalog.Availability)).available)
			{
				Log.Error("Cannot modify BuffQualityGroup buffs after QualityCatalog is initialized", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "checkCanModify", 62);
				return false;
			}
			return true;
		}

		public BuffIndex GetBuffIndex(QualityTier qualityTier)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0034: 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)
			return (BuffIndex)(qualityTier switch
			{
				QualityTier.None => BaseBuffIndex, 
				QualityTier.Uncommon => UncommonBuffIndex, 
				QualityTier.Rare => RareBuffIndex, 
				QualityTier.Epic => EpicBuffIndex, 
				QualityTier.Legendary => LegendaryBuffIndex, 
				_ => throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"), 
			});
		}

		public BuffDef GetBuffDef(QualityTier qualityTier)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			return (BuffDef)(qualityTier switch
			{
				QualityTier.None => BuffCatalog.GetBuffDef(BaseBuffIndex), 
				QualityTier.Uncommon => _uncommonBuff, 
				QualityTier.Rare => _rareBuff, 
				QualityTier.Epic => _epicBuff, 
				QualityTier.Legendary => _legendaryBuff, 
				_ => throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"), 
			});
		}

		public void SetBuffDef(BuffDef buffDef, QualityTier qualityTier)
		{
			if (checkCanModify())
			{
				switch (qualityTier)
				{
				case QualityTier.None:
					Log.Warning("Cannot change base buff (group: '" + ((Object)this).name + "')", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "SetBuffDef", 115);
					break;
				case QualityTier.Uncommon:
					_uncommonBuff = buffDef;
					break;
				case QualityTier.Rare:
					_rareBuff = buffDef;
					break;
				case QualityTier.Epic:
					_epicBuff = buffDef;
					break;
				case QualityTier.Legendary:
					_legendaryBuff = buffDef;
					break;
				default:
					throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented");
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")]
		public BuffQualityCounts GetBuffCounts(CharacterBody body)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return default(BuffQualityCounts);
			}
			return body.GetBuffCounts(this);
		}

		[Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")]
		public bool HasBuff(CharacterBody body)
		{
			QualityTier buffQualityTier;
			return HasBuff(body, out buffQualityTier);
		}

		[Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")]
		public bool HasBuff(CharacterBody body, out QualityTier buffQualityTier)
		{
			BuffQualityCounts buffCounts = GetBuffCounts(body);
			buffQualityTier = buffCounts.HighestQuality;
			return buffCounts.TotalCount > 0;
		}

		[Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")]
		public bool HasQualityBuff(CharacterBody body)
		{
			QualityTier buffQualityTier;
			return HasQualityBuff(body, out buffQualityTier);
		}

		[Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")]
		public bool HasQualityBuff(CharacterBody body, out QualityTier buffQualityTier)
		{
			if (HasBuff(body, out buffQualityTier))
			{
				return buffQualityTier > QualityTier.None;
			}
			return false;
		}

		[Obsolete("Use CharacterBodyExtensions.RemoveAllBuffs/RemoveAllQualityBuffs/ConvertQualityBuffsToTier/ConvertAllBuffsToQualityTier() instead")]
		public void EnsureBuffQualities(CharacterBody body, QualityTier buffQualityTier, bool includeBaseBuff = false)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			if (buffQualityTier == QualityTier.None)
			{
				if (includeBaseBuff)
				{
					body.RemoveAllBuffs(this);
				}
				else
				{
					body.RemoveAllQualityBuffs(this);
				}
			}
			else if (includeBaseBuff)
			{
				body.ConvertAllBuffsToQualityTier(this, buffQualityTier);
			}
			else
			{
				body.ConvertQualityBuffsToTier(this, buffQualityTier);
			}
		}

		IEnumerator IAsyncContentLoadCallback.OnContentLoad(IProgress<float> progressReceiver)
		{
			if (Object.op_Implicit((Object)(object)BaseBuff))
			{
				populateBuffs(BaseBuff);
			}
			else if (BaseBuffReference != null && ((AssetReference)BaseBuffReference).RuntimeKeyIsValid())
			{
				AsyncOperationHandle<BuffDef> baseBuffLoad = AssetAsyncReferenceManager<BuffDef>.LoadAsset(BaseBuffReference, (AsyncReferenceHandleUnloadType)2);
				yield return baseBuffLoad.AsProgressCoroutine<BuffDef>(progressReceiver);
				if (baseBuffLoad.IsValid() && (int)baseBuffLoad.Status == 1)
				{
					populateBuffs(baseBuffLoad.Result);
				}
				else
				{
					Log.Error(string.Format("Failed to load base buff for quality group '{0}': {1}", ((Object)this).name, baseBuffLoad.IsValid() ? ((object)baseBuffLoad.OperationException) : ((object)"Invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "OnContentLoad", 214);
				}
				AssetAsyncReferenceManager<BuffDef>.UnloadAsset(BaseBuffReference);
			}
			progressReceiver.Report(1f);
			void populateBuffs(BuffDef baseBuff)
			{
				populateBuffAsset(_uncommonBuff, QualityTier.Uncommon);
				populateBuffAsset(_rareBuff, QualityTier.Rare);
				populateBuffAsset(_epicBuff, QualityTier.Epic);
				populateBuffAsset(_legendaryBuff, QualityTier.Legendary);
				void populateBuffAsset(BuffDef buff, QualityTier qualityTier)
				{
					if (!Object.op_Implicit((Object)(object)buff))
					{
						Log.Warning($"Missing variant '{qualityTier}' in buff group '{((Object)this).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "OnContentLoad", 228);
					}
					else
					{
						if (!Object.op_Implicit((Object)(object)buff.eliteDef))
						{
							buff.eliteDef = baseBuff.eliteDef;
						}
						if (!Object.op_Implicit((Object)(object)buff.startSfx))
						{
							buff.startSfx = baseBuff.startSfx;
						}
					}
				}
			}
		}

		internal IEnumerator GenerateRuntimeAssetsAsync(ExtendedContentPack contentPack, IProgress<float> progressReceiver = null)
		{
			if (Object.op_Implicit((Object)(object)BaseBuff))
			{
				generateRuntimeAssets(BaseBuff);
			}
			else if (BaseBuffReference != null && ((AssetReference)BaseBuffReference).RuntimeKeyIsValid())
			{
				AsyncOperationHandle<BuffDef> baseBuffLoad = AssetAsyncReferenceManager<BuffDef>.LoadAsset(BaseBuffReference, (AsyncReferenceHandleUnloadType)2);
				IEnumerator enumerator2;
				if (progressReceiver == null)
				{
					IEnumerator enumerator = (IEnumerator)(object)baseBuffLoad;
					enumerator2 = enumerator;
				}
				else
				{
					enumerator2 = baseBuffLoad.AsProgressCoroutine<BuffDef>(progressReceiver);
				}
				yield return enumerator2;
				if (baseBuffLoad.IsValid() && (int)baseBuffLoad.Status == 1)
				{
					generateRuntimeAssets(base