Decompiled source of FruityBossDrop v1.3.1

BossDropRework.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using R2API;
using R2API.Utils;
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";

	public static BuffDef NoBossDropsBuff;

	public static BuffDef YesBossDropsBuff;

	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; }

	internal static ConfigFile CustomConfigFile { get; private set; }

	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> ReworkPrinters { get; set; }

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

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

	public static GameObject overgrownPrinterPrefab => LegacyResourcesAPI.Load<GameObject>("prefabs/networkedobjects/chest/DuplicatorWild");

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

	public static event BossDropChanceHandler ModifyBossItemDropChance;

	public static event TricornFireHandler ShouldTricornFireAndBreak;

	public void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: 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_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: 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_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\FruityBossDrops.cfg", true);
		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");
		ReworkTricorn = CustomConfigFile.Bind<bool>("Reworks", "Rework Tricorn", true, "");
		ReworkVultures = CustomConfigFile.Bind<bool>("Reworks", "Rework Wake of Vultures", true, "Turns it into a Horde of Many trophy");
		ReworkPrinters = CustomConfigFile.Bind<bool>("Reworks", "Rework Overgrown Printers", true, "Removes Overgrown Printers from the game");
		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");
		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 = "TrophyHunterDebuff";
		YesBossDropsBuff.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/LunarSkillReplacements/texBuffLunarDetonatorIcon.tif").WaitForCompletion();
		YesBossDropsBuff.isHidden = true;
		ContentAddition.AddBuffDef(YesBossDropsBuff);
		BossesDropBossItems();
		if (ReworkTricorn.Value)
		{
			TricornRework();
		}
		if (ReworkVultures.Value)
		{
			WakeOfVulturesRework();
		}
		if (ReworkPrinters.Value)
		{
			DirectorAPI.InteractableActions += DeleteYellowPrinters;
		}
	}

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

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

	private void RemoveBossItemDropsFromTeleporter(orig_Awake orig, BossGroup self)
	{
		orig.Invoke(self);
		self.bossDropChance = 0f;
	}

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

	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(NoBossDropsBuff))
		{
			return false;
		}
		BodyIndex bodyIndex = victimBody.bodyIndex;
		if (bodyIndex == BodyCatalog.FindBodyIndex("TitanGoldBody") && !ForceDropsFromAurelionite.Value)
		{
			return false;
		}
		return true;
	}

	public void BossesDropTrophies(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Invalid comparison between Unknown and I4
		orig.Invoke(self, damageReport);
		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_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_0081: 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_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: 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_009d: 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)
		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);
		}
	}

	public static float GetBaseBossItemDropChanceFromBody(CharacterBody body, out PickupDropTable dropTable)
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		DeathRewards deathRewardsFromTarget = GetDeathRewardsFromTarget(body);
		if ((Object)(object)deathRewardsFromTarget == (Object)null || (Object)(object)deathRewardsFromTarget.bossDropTable == (Object)null)
		{
			dropTable = null;
			return 0f;
		}
		dropTable = deathRewardsFromTarget.bossDropTable;
		BodyIndex bodyIndex = body.bodyIndex;
		if (bodyIndex == BodyCatalog.FindBodyIndex("TitanGoldBody"))
		{
			return ForceDropsFromAurelionite.Value ? 100 : 0;
		}
		if (deathRewardsFromTarget.goldReward == 0)
		{
			return 0f;
		}
		if (bodyIndex == BodyCatalog.FindBodyIndex("SuperRoboBallBossBody") || bodyIndex == BodyCatalog.FindBodyIndex("VultureHunterBody"))
		{
			return SpecialBossDropChance.Value;
		}
		bool isChampion = body.isChampion;
		bool flag = body.isElite || bodyIndex == BodyCatalog.FindBodyIndex("ElectricWormBody");
		if (isChampion)
		{
			if (flag)
			{
				return ChampionEliteDropChance.Value;
			}
			return ChampionDropChance.Value;
		}
		if (flag)
		{
			return EliteDropChance.Value;
		}
		return 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>();
	}

	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(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(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(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 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;
		}
	}
}