Decompiled source of FruityBossDrop v1.4.1

BossDropRework.dll

Decompiled a week ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BossDropRework.Modules;
using On.RoR2;
using R2API;
using R2API.Utils;
using RainrotSharedUtils.Difficulties;
using RoR2;
using RoR2.Audio;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BossDropRework")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BossDropRework")]
[assembly: AssemblyTitle("BossDropRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace BossDropRework
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.RiskOfBrainrot.FruityBossDrops", "FruityBossDrops", "1.2.2")]
	[R2APISubmoduleDependency(new string[] { "LanguageAPI", "ContentAddition", "DirectorAPI" })]
	public class BossDropReworkPlugin : BaseUnityPlugin
	{
		public delegate void BossDropChanceHandler(CharacterBody victim, CharacterBody attacker, ref float dropChance);

		public delegate void TricornFireHandler(CharacterBody attacker, CharacterBody victim, ref bool shouldFire);

		public const string guid = "com.RiskOfBrainrot.FruityBossDrops";

		public const string teamName = "RiskOfBrainrot";

		public const string modName = "FruityBossDrops";

		public const string version = "1.2.2";

		private static PickupDef voidMarkerPickup;

		public static int trophyHunterCurseCount = 33;

		public static int trophyHunterDebuffDuration = 999;

		public static bool reworkTricorn = true;

		public static ExplicitPickupDropTable hordeDropTable;

		public static PluginInfo PInfo { get; private set; }

		public static float trophyHunterMaxHealthDamage => (float)trophyHunterCurseCount / (100f + (float)trophyHunterCurseCount);

		public static event BossDropChanceHandler ModifyBossItemDropChance;

		public static event TricornFireHandler ShouldTricornFireAndBreak;

		public void Awake()
		{
			Bindings.Init();
			CommonAssets.Init();
			BossesDropBossItems();
			if (Bindings.BindSection("Trophy Hunters Tricorn"))
			{
				TricornRework();
			}
			if (Bindings.BindSection("Wake of Vultures (HOM Boss Item)"))
			{
				WakeOfVulturesRework();
			}
			if (Bindings.BindSection("Horde of Many (Forced Elite)"))
			{
				HordeOfManyRework();
			}
			if (Bindings.BindSection("Overgrown Printers"))
			{
				DirectorAPI.InteractableActions += DeleteYellowPrinters;
			}
			Bindings.Save();
		}

		private void DeleteYellowPrinters(DccsPool pool, StageInfo currentStage)
		{
			Helpers.RemoveExistingInteractable(InteractableNames.PrinterOvergrown3D);
		}

		public static float InvokeModifyBossItemDropChance(CharacterBody victim, CharacterBody attacker, ref float dropChance)
		{
			BossDropReworkPlugin.ModifyBossItemDropChance?.Invoke(victim, attacker, ref dropChance);
			return dropChance;
		}

		public static float GetBaseBossItemDropChanceFromBody(CharacterBody body, out PickupDropTable dropTable)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			DeathRewards deathRewardsFromTarget = GetDeathRewardsFromTarget(body);
			if ((Object)(object)deathRewardsFromTarget == (Object)null || !DropTableValid(deathRewardsFromTarget.bossDropTable))
			{
				dropTable = null;
				return 0f;
			}
			dropTable = deathRewardsFromTarget.bossDropTable;
			BodyIndex bodyIndex = body.bodyIndex;
			if (bodyIndex == BodyCatalog.FindBodyIndex("TitanGoldBody"))
			{
				return Bindings.ForceDropsFromAurelionite.Value ? 100 : 0;
			}
			if (deathRewardsFromTarget.goldReward == 0)
			{
				Debug.Log((object)"FruityBossDrop: Enemy will not drop rewards due to dropping no gold. Is this an error?");
				return 0f;
			}
			if (bodyIndex == BodyCatalog.FindBodyIndex("SuperRoboBallBossBody") || bodyIndex == BodyCatalog.FindBodyIndex("VultureHunterBody"))
			{
				return Bindings.SpecialBossDropChance.Value;
			}
			bool isChampion = body.isChampion;
			bool flag = body.isElite || bodyIndex == BodyCatalog.FindBodyIndex("ElectricWormBody");
			if (isChampion)
			{
				if (flag)
				{
					return Bindings.ChampionEliteDropChance.Value;
				}
				return Bindings.ChampionDropChance.Value;
			}
			if (flag)
			{
				return Bindings.EliteDropChance.Value;
			}
			return Bindings.LesserDropChance.Value;
		}

		public static DeathRewards GetDeathRewardsFromTarget(HurtBox hurtBox)
		{
			if ((Object)(object)hurtBox == (Object)null)
			{
				return null;
			}
			HealthComponent healthComponent = hurtBox.healthComponent;
			if ((Object)(object)healthComponent == (Object)null)
			{
				return null;
			}
			return GetDeathRewardsFromTarget(healthComponent.body);
		}

		public static DeathRewards GetDeathRewardsFromTarget(CharacterBody enemyBody)
		{
			if ((Object)(object)enemyBody == (Object)null)
			{
				return null;
			}
			return ((Component)enemyBody).GetComponent<DeathRewards>();
		}

		public static bool GetBossDropFilter(CharacterBody victimBody)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)victimBody == (Object)null)
			{
				return false;
			}
			if (victimBody.HasBuff(CommonAssets.NoBossDropsBuff))
			{
				return false;
			}
			BodyIndex bodyIndex = victimBody.bodyIndex;
			if (bodyIndex == BodyCatalog.FindBodyIndex("TitanGoldBody") && !Bindings.ForceDropsFromAurelionite.Value)
			{
				return false;
			}
			return true;
		}

		public static bool DropTableValid(PickupDropTable dropTable)
		{
			if ((Object)(object)dropTable == (Object)null || dropTable.GetPickupCount() <= 0)
			{
				return false;
			}
			ExplicitPickupDropTable val = (ExplicitPickupDropTable)(object)((dropTable is ExplicitPickupDropTable) ? dropTable : null);
			if (val != null)
			{
				if (val.weightedSelection.Count == 0)
				{
					val.GenerateWeightedSelection();
				}
				return val.weightedSelection.choices.Any((ChoiceInfo<UniquePickup> x) => x.value.pickupIndex != PickupCatalog.FindPickupIndex("MiscPickupIndex.VoidCoin") && x.value.pickupIndex != PickupIndex.none);
			}
			return true;
		}

		private void BossesDropBossItems()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			BossGroup.Awake += new hook_Awake(RemoveBossItemDropsFromTeleporter);
			GlobalEventManager.onCharacterDeathServer += BossesDropTrophies;
		}

		private void RemoveBossItemDropsFromTeleporter(orig_Awake orig, BossGroup self)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (((Object)((Component)self).gameObject).name == "TitanGoldBossEncounter" || (Object)(object)GoldshoresMissionController.instance != (Object)null)
			{
				if (!Bindings.ForceDropsFromAurelionite.Value)
				{
					return;
				}
				self.dropTable = Addressables.LoadAssetAsync<PickupDropTable>((object)RoR2_Base_Common.dtTier2Item_asset).WaitForCompletion();
			}
			self.bossDropChance = 0f;
		}

		public void BossesDropTrophies(DamageReport damageReport)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)damageReport.victimTeamIndex != 1)
			{
				CharacterBody attackerBody = damageReport.attackerBody;
				CharacterBody victimBody = damageReport.victimBody;
				if (!((Object)(object)attackerBody == (Object)null) && GetBossDropFilter(victimBody) && !victimBody.healthComponent.alive)
				{
					CharacterMaster attackerMaster = damageReport.attackerMaster;
					ItemDef val = null;
					int participatingPlayerCount = Run.instance.participatingPlayerCount;
					DropItem(attackerBody, victimBody, attackerMaster);
				}
			}
		}

		internal static void DropItem(CharacterBody attackerBody, CharacterBody enemyBody, CharacterMaster killerMaster, float dropChanceOverride = -1f)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0096: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			PickupDropTable dropTable;
			float dropChance = GetBaseBossItemDropChanceFromBody(enemyBody, out dropTable);
			if (dropChanceOverride > 0f)
			{
				dropChance = dropChanceOverride;
			}
			if (dropChance > 0f && (Object)(object)dropTable != (Object)null && InvokeModifyBossItemDropChance(enemyBody, attackerBody, ref dropChance) > 0f && Util.CheckRoll(dropChance, killerMaster))
			{
				UniquePickup val = dropTable.GeneratePickup(Run.instance.bossRewardRng);
				Vector3 val2 = (Object.op_Implicit((Object)(object)enemyBody) ? enemyBody.corePosition : Vector3.zero);
				Vector3 val3 = val2 - attackerBody.corePosition;
				Vector3 normalized = ((Vector3)(ref val3)).normalized;
				PickupDropletController.CreatePickupDroplet(val, val2, normalized * 15f, false);
			}
		}

		private void TricornRework()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			EquipmentSlot.FireBossHunter += new hook_FireBossHunter(FireTricornFix);
			ModifyBossItemDropChance += TricornDropChance;
			LanguageAPI.Add("EQUIPMENT_BOSSHUNTER_PICKUP", "Cripple a large monster and claim its <style=cIsDamage>trophy</style>. Consumed on use.");
			LanguageAPI.Add("EQUIPMENT_BOSSHUNTER_DESC", "Targets any enemy capable of dropping a <style=cIsDamage>trophy item</style>. " + $"Blast it for <style=cIsDamage>{Mathf.CeilToInt(trophyHunterMaxHealthDamage * 100f)}% max health</style>, " + "instantly severing its <style=cIsDamage>trophy item</style>, and Crippling and Hemorrhaging it " + $"for <style=cIsUtility>{trophyHunterDebuffDuration}</style> seconds.");
		}

		private void TricornDropChance(CharacterBody victim, CharacterBody attacker, ref float dropChance)
		{
			if (victim.HasBuff(CommonAssets.NoBossDropsBuff) && dropChance != 0f)
			{
				dropChance = 100f;
			}
		}

		public static bool GetTricornFireAndBreak(CharacterBody attacker, CharacterBody victim, ref bool shouldFire)
		{
			BossDropReworkPlugin.ShouldTricornFireAndBreak?.Invoke(attacker, victim, ref shouldFire);
			return shouldFire;
		}

		private bool FireTricornFix(orig_FireBossHunter orig, EquipmentSlot self)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Expected O, but got Unknown
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Expected O, but got Unknown
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			self.UpdateTargets(Equipment.BossHunter.equipmentIndex, true);
			HurtBox hurtBox = self.currentTarget.hurtBox;
			DeathRewards deathRewardsFromTarget = GetDeathRewardsFromTarget(hurtBox);
			if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)deathRewardsFromTarget))
			{
				HealthComponent healthComponent = hurtBox.healthComponent;
				if ((Object)(object)healthComponent != (Object)null)
				{
					CharacterBody characterBody = self.characterBody;
					CharacterBody body = healthComponent.body;
					if ((Object)(object)body != (Object)null && (Object)(object)characterBody != (Object)null)
					{
						bool flag = false;
						Vector3 val = (Object.op_Implicit((Object)(object)body) ? body.corePosition : Vector3.zero);
						Vector3 val2 = val - characterBody.corePosition;
						Vector3 normalized = ((Vector3)(ref val2)).normalized;
						Object val3 = (val3 = (Object)(object)(((Object)(object)body != (Object)null) ? body.master : null));
						if (Object.op_Implicit(val3))
						{
							bool shouldFire = true;
							if (GetTricornFireAndBreak(characterBody, body, ref shouldFire))
							{
								flag = true;
							}
							if (reworkTricorn)
							{
								DropItem(characterBody, body, characterBody.master, 100f);
								body.AddBuff(CommonAssets.NoBossDropsBuff);
								for (int i = 0; i < trophyHunterCurseCount; i++)
								{
									body.AddBuff(Buffs.PermanentCurse);
								}
								body.AddTimedBuffAuthority(Buffs.Cripple.buffIndex, (float)trophyHunterDebuffDuration);
								DotController.InflictDot(((Component)healthComponent).gameObject, ((Component)characterBody).gameObject, hurtBox, (DotIndex)6, (float)trophyHunterDebuffDuration, 1f, (uint?)null);
								FakeEnemyDeath(body);
							}
							else
							{
								body.AddBuff(CommonAssets.YesBossDropsBuff);
								body.master.TrueKill(((Component)this).gameObject, (GameObject)null, default(DamageTypeCombo));
							}
						}
						CharacterModel component = ((Component)hurtBox.hurtBoxGroup).GetComponent<CharacterModel>();
						if (Object.op_Implicit((Object)(object)component))
						{
							TemporaryOverlayInstance val4 = TemporaryOverlayManager.AddOverlay(((Component)component).gameObject);
							val4.duration = 0.1f;
							val4.animateShaderAlpha = true;
							val4.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
							val4.destroyComponentOnEnd = true;
							val4.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matHuntressFlashBright");
							val4.AddToCharacterModel(component);
							TemporaryOverlayInstance val5 = TemporaryOverlayManager.AddOverlay(((Component)component).gameObject);
							val5.duration = 1.2f;
							val5.animateShaderAlpha = true;
							val5.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
							val5.destroyComponentOnEnd = true;
							val5.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matGhostEffect");
							val5.AddToCharacterModel(component);
						}
						DamageInfo val6 = new DamageInfo();
						val6.attacker = ((Component)self).gameObject;
						val6.force = -normalized * 2500f;
						self.healthComponent.TakeDamageForce(val6, true, false);
						GameObject val7 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BossHunterKillEffect");
						Quaternion rotation = Util.QuaternionSafeLookRotation(normalized, Vector3.up);
						EffectManager.SpawnEffect(val7, new EffectData
						{
							origin = val,
							rotation = rotation
						}, true);
						ModelLocator component2 = ((Component)this).gameObject.GetComponent<ModelLocator>();
						CharacterModel val8;
						if ((Object)(object)component2 == (Object)null)
						{
							val8 = null;
						}
						else
						{
							Transform modelTransform = component2.modelTransform;
							val8 = (((Object)(object)modelTransform != (Object)null) ? ((Component)modelTransform).GetComponent<CharacterModel>() : null);
						}
						CharacterModel val9 = val8;
						if (Object.op_Implicit((Object)(object)val9))
						{
							foreach (GameObject equipmentDisplayObject in val9.GetEquipmentDisplayObjects(Equipment.BossHunter.equipmentIndex))
							{
								if (((Object)equipmentDisplayObject).name.Contains("DisplayTricorn"))
								{
									EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BossHunterHatEffect"), new EffectData
									{
										origin = equipmentDisplayObject.transform.position,
										rotation = equipmentDisplayObject.transform.rotation,
										scale = equipmentDisplayObject.transform.localScale.x
									}, true);
								}
								else
								{
									EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BossHunterGunEffect"), new EffectData
									{
										origin = equipmentDisplayObject.transform.position,
										rotation = Util.QuaternionSafeLookRotation(val - equipmentDisplayObject.transform.position, Vector3.up),
										scale = equipmentDisplayObject.transform.localScale.x
									}, true);
								}
							}
						}
						if (Object.op_Implicit((Object)(object)(((Object)(object)characterBody != (Object)null) ? characterBody.inventory : null)) && flag)
						{
							CharacterMasterNotificationQueue.SendTransformNotification(self.characterBody.master, self.characterBody.inventory.currentEquipmentIndex, Equipment.BossHunterConsumed.equipmentIndex, (TransformationType)0);
							self.characterBody.inventory.SetEquipmentIndex(Equipment.BossHunterConsumed.equipmentIndex);
						}
						self.InvalidateCurrentTarget();
						return true;
					}
				}
			}
			return false;
		}

		private void FakeEnemyDeath(CharacterBody enemyBody)
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			CharacterDeathBehavior val = default(CharacterDeathBehavior);
			if (((Component)enemyBody).TryGetComponent<CharacterDeathBehavior>(ref val) && val.deathAkEvent != null)
			{
				val.deathAkEvent.Post(((Component)val).gameObject);
			}
			SfxLocator sfxLocator = enemyBody.sfxLocator;
			Transform modelBaseTransform = enemyBody.modelLocator.modelBaseTransform;
			if (Object.op_Implicit((Object)(object)sfxLocator) && sfxLocator.deathSound != "" && (Object)(object)modelBaseTransform != (Object)null)
			{
				PointSoundManager.EmitSoundLocal(sfxLocator.deathSound, Object.op_Implicit((Object)(object)((Component)modelBaseTransform).gameObject) ? ((Component)modelBaseTransform).gameObject.transform.position : ((Component)this).gameObject.transform.position);
			}
			GameObject deathEffectPrefab = GetDeathEffectPrefab(enemyBody);
			if (!((Object)(object)deathEffectPrefab == (Object)null))
			{
				if (!EffectManager.ShouldUsePooledEffect(deathEffectPrefab))
				{
					EffectManager.SimpleEffect(deathEffectPrefab, enemyBody.transform.position, enemyBody.transform.rotation, false);
				}
				else
				{
					EffectManager.GetAndActivatePooledEffect(deathEffectPrefab, enemyBody.transform.position, enemyBody.transform.rotation);
				}
			}
		}

		private GameObject GetDeathEffectPrefab(CharacterBody enemyBody)
		{
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			switch (enemyBody.baseNameToken)
			{
			case "TITAN_BODY_NAME":
				text = RoR2_Base_Titan.TitanDeathEffect_prefab;
				break;
			case "TITANGOLD_BODY_NAME":
				text = RoR2_Base_Titan.TitanGoldDeathEffect_prefab;
				break;
			case "BEETLEQUEEN_BODY_NAME":
				text = RoR2_Base_BeetleQueen.BeetleQueenDeathImpact_prefab;
				break;
			case "CLAYBOSS_BODY_NAME":
				text = RoR2_Base_ClayBoss.ClayBossDeath_prefab;
				break;
			case "GRANDPARENT_BODY_NAME":
				text = RoR2_Base_Grandparent.GrandparentDeathEffect_prefab;
				break;
			case "GRAVEKEEPER_BODY_NAME":
				text = RoR2_Base_Gravekeeper.GravekeeperDeathImpact_prefab;
				break;
			case "IMPBOSS_BODY_NAME":
				text = RoR2_Base_ImpBoss.ImpBossDeathEffect_prefab;
				break;
			case "MAGMAWORM_BODY_NAME":
				text = RoR2_Base_MagmaWorm.MagmaWormDeath_prefab;
				break;
			case "ELECTRICWORM_BODY_NAME":
				text = RoR2_Base_MagmaWorm.MagmaWormDeath_prefab;
				break;
			case "SCAV_BODY_NAME":
				text = "";
				break;
			case "ROBOBALLBOSS_BODY_NAME":
			case "SUPERROBOBALLBOSS_BODY_NAME":
				text = RoR2_Base_RoboBallBoss.OmniExplosionVFXRoboBallBossDeath_prefab;
				break;
			case "VAGRANT_BODY_NAME":
				text = RoR2_Base_Vagrant.VagrantDeathExplosion_prefab;
				break;
			case "MEGACONSTRUCT_BODY_NAME":
				text = RoR2_DLC1_MajorAndMinorConstruct.MajorConstructDeathEffect_prefab;
				break;
			case "VOIDMEGACRAB_BODY_NAME":
				text = "";
				break;
			case "SOLUSAMALGAMATOR_BODY_NAME":
				text = RoR2_DLC3_SolusAmalgamator.SolusAmalgamatorExplosionVFXDeath_prefab;
				break;
			case "VULTUREHUNTER_BODY_NAME":
				text = RoR2_DLC3_VultureHunter.VultureHunterSkyDeath_prefab;
				break;
			}
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			return Addressables.LoadAssetAsync<GameObject>((object)text).WaitForCompletion();
		}

		private void HordeOfManyRework()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			DifficultyUtilsModule.UseForceElite = true;
			DifficultyUtilsModule.ForceEliteMasterProvider += new ForceEliteMasterEventHandler(ForceHordeOfManyElite);
		}

		private static bool ForceHordeOfManyElite(CharacterMaster sender)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)sender.teamIndex != 2)
			{
				return false;
			}
			if (!sender.isBoss)
			{
				return false;
			}
			CharacterBody val = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)sender.bodyPrefab) && sender.bodyPrefab.TryGetComponent<CharacterBody>(ref val) && !val.isChampion)
			{
				return true;
			}
			return false;
		}

		private void WakeOfVulturesRework()
		{
			//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_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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)RoR2_Base_HeadHunter.HeadHunter_asset).WaitForCompletion();
			val.tier = (ItemTier)4;
			val.deprecatedTier = (ItemTier)4;
			PickupDefEntry val2 = new PickupDefEntry
			{
				pickupDef = (Object)(object)val
			};
			hordeDropTable = ScriptableObject.CreateInstance<ExplicitPickupDropTable>();
			((PickupDropTable)hordeDropTable).canDropBeReplaced = true;
			List<PickupDefEntry> list = new List<PickupDefEntry>();
			list.Add(new PickupDefEntry
			{
				pickupDef = (Object)(object)val,
				pickupWeight = 1f
			});
			hordeDropTable.pickupEntries = list.ToArray();
			BossGroup.OnMemberDiscovered += new hook_OnMemberDiscovered(SetHordeDropTable);
		}

		private void SetHordeDropTable(orig_OnMemberDiscovered orig, BossGroup self, CharacterMaster memberMaster)
		{
			orig.Invoke(self, memberMaster);
			CharacterBody body = memberMaster.GetBody();
			if (Object.op_Implicit((Object)(object)body) && !body.isChampion)
			{
				DeathRewards component = ((Component)body).GetComponent<DeathRewards>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.bossDropTable = (PickupDropTable)(object)hordeDropTable;
				}
			}
		}

		private void SetDropTableForHordesOfMany(orig_Awake orig, DeathRewards self)
		{
			orig.Invoke(self);
			CharacterBody characterBody = self.characterBody;
			if (Object.op_Implicit((Object)(object)characterBody) && characterBody.isBoss && (Object)(object)self.bossDropTable == (Object)null)
			{
				self.bossDropTable = (PickupDropTable)(object)hordeDropTable;
			}
		}
	}
}
namespace BossDropRework.Modules
{
	public static class CommonAssets
	{
		public static BuffDef NoBossDropsBuff;

		public static BuffDef YesBossDropsBuff;

		public static void Init()
		{
			CreateForceDropsBuffs();
		}

		private static void CreateForceDropsBuffs()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			NoBossDropsBuff = ScriptableObject.CreateInstance<BuffDef>();
			NoBossDropsBuff.buffColor = new Color(0.2f, 0.9f, 0.8f, 1f);
			NoBossDropsBuff.canStack = false;
			NoBossDropsBuff.isDebuff = false;
			BuffDef noBossDropsBuff = NoBossDropsBuff;
			noBossDropsBuff.flags = (Flags)(noBossDropsBuff.flags | 1);
			((Object)NoBossDropsBuff).name = "TrophyHunterDebuff";
			NoBossDropsBuff.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/LunarSkillReplacements/texBuffLunarDetonatorIcon.tif").WaitForCompletion();
			NoBossDropsBuff.isHidden = true;
			ContentAddition.AddBuffDef(NoBossDropsBuff);
			YesBossDropsBuff = ScriptableObject.CreateInstance<BuffDef>();
			YesBossDropsBuff.buffColor = new Color(0.2f, 0.9f, 0.8f, 1f);
			YesBossDropsBuff.canStack = false;
			YesBossDropsBuff.isDebuff = false;
			BuffDef yesBossDropsBuff = YesBossDropsBuff;
			yesBossDropsBuff.flags = (Flags)(yesBossDropsBuff.flags | 1);
			((Object)YesBossDropsBuff).name = "TrophyHunterDebuff2";
			YesBossDropsBuff.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/LunarSkillReplacements/texBuffLunarDetonatorIcon.tif").WaitForCompletion();
			YesBossDropsBuff.isHidden = true;
			ContentAddition.AddBuffDef(YesBossDropsBuff);
		}
	}
	public static class Tools
	{
		internal static bool isLoaded(string modguid)
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				string key = pluginInfo.Key;
				PluginInfo value = pluginInfo.Value;
				if (key == modguid)
				{
					return true;
				}
			}
			return false;
		}
	}
	public static class Assets
	{
		internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>();

		internal static AssetBundle LoadAssetBundle(string bundleName)
		{
			if (loadedBundles.ContainsKey(bundleName))
			{
				return loadedBundles[bundleName];
			}
			AssetBundle val = null;
			val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(BossDropReworkPlugin.PInfo.Location), bundleName));
			loadedBundles[bundleName] = val;
			return val;
		}
	}
	public static class Bindings
	{
		public static ConfigEntry<float> LesserDropChance { get; set; }

		public static ConfigEntry<float> EliteDropChance { get; set; }

		public static ConfigEntry<float> ChampionDropChance { get; set; }

		public static ConfigEntry<float> ChampionEliteDropChance { get; set; }

		public static ConfigEntry<float> SpecialBossDropChance { get; set; }

		public static ConfigEntry<bool> ForceDropsFromAurelionite { get; set; }

		public static ConfigEntry<bool> ReworkTricorn { get; set; }

		public static ConfigEntry<bool> ReworkVultures { get; set; }

		public static ConfigEntry<bool> ReworkHordeOfMany { get; set; }

		public static ConfigEntry<bool> ReworkPrinters { get; set; }

		public static ConfigEntry<float> TricornDamageCoefficient { get; set; }

		public static ConfigEntry<float> TricornProcCoefficient { get; set; }

		internal static ConfigFile CustomConfigFile { get; set; }

		public static bool BindSection(string sectionName)
		{
			return CustomConfigFile.Bind<bool>("Fruity Boss Drop : Full Section Config", sectionName, true, "Vanilla is FALSE. Set to false if you wish to disable changes made to an entire item or group of items.").Value;
		}

		public static void Init()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			string text = "Fruity Boss Drop : ";
			CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\FruityBossDrops.cfg", true);
			CustomConfigFile.SaveOnConfigSet = false;
			LesserDropChance = CustomConfigFile.Bind<float>("Trophy Drops", "Droprate for Non-Elite Lessers", 0.5f, "Includes Horde of Many");
			EliteDropChance = CustomConfigFile.Bind<float>("Trophy Drops", "Droprate for Elite Lessers", 2f, "Includes Horde of Many");
			ChampionDropChance = CustomConfigFile.Bind<float>("Trophy Drops", "Droprate for Non-Elite Champions", 6f, "");
			ChampionEliteDropChance = CustomConfigFile.Bind<float>("Trophy Drops", "Droprate for Elite Champions", 10f, "");
			SpecialBossDropChance = CustomConfigFile.Bind<float>("Trophy Drops", "Droprate for Special Bosses", 14f, "Affects AWU");
			ForceDropsFromAurelionite = CustomConfigFile.Bind<bool>("Trophy Drops", "Force Drops From Aurelionite", true, "Force Aurelionite to drop a Halcyon Seed on death, replacing the portal loot with 1 green for each player. Recommended to set to false for use with GildedCoastPlus");
			TricornDamageCoefficient = CustomConfigFile.Bind<float>("Tricorn", "Tricorn Damage Coefficient", 70f, "Multiply by 100 for % ie 70 is 7000%");
			TricornProcCoefficient = CustomConfigFile.Bind<float>("Tricorn", "Tricorn Proc Coefficient", 5f, "Most attacks default to 1. Recommended to install ProcPatcher");
		}

		public static void Save()
		{
			CustomConfigFile.SaveOnConfigSet = true;
			CustomConfigFile.Save();
		}
	}
}