Decompiled source of NewtDrop v2.0.0

NewtDrop.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NewtDrop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NewtDrop")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("254c74c4-954d-47e9-83cb-712e1de44379")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NewtDrop;

internal class CeremonialFireworks
{
	internal static AssetBundle Bundle;

	public static ConfigFile Config;

	private static ItemDef CeremonialFireworksDef;

	private static readonly int BaseFireworkNum = 8;

	private static readonly int ScalingFireworkNum = 4;

	private static readonly int BasePercentage = 50;

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

	internal static void Init()
	{
		Config = NewtDrop.NewtConfig;
		Bundle = NewtDrop.bundle;
		CreateConfig();
		if (EnableCeremonialFireworksConfig.Value)
		{
			CreateItem();
			Hooks();
		}
	}

	private static void CreateConfig()
	{
		EnableCeremonialFireworksConfig = Config.Bind<bool>("Items", "Ceremonial Fireworks", true, "Enable this item?");
	}

	private static void CreateItem()
	{
		//IL_005d: 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_00b5: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		CeremonialFireworksDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)CeremonialFireworksDef).name = "CF";
		CeremonialFireworksDef.nameToken = "CF";
		CeremonialFireworksDef.descriptionToken = "CF_Desc";
		CeremonialFireworksDef.loreToken = "CF_Lore";
		CeremonialFireworksDef.pickupToken = "CF_Pickup";
		CeremonialFireworksDef.deprecatedTier = (ItemTier)2;
		CeremonialFireworksDef.pickupIconSprite = Bundle.LoadAsset<Sprite>("Assets/CeremonialFireworks.png");
		CeremonialFireworksDef.pickupModelPrefab = Resources.Load<GameObject>("Prefabs/PickupModels/PickupFirework");
		CeremonialFireworksDef.canRemove = true;
		CeremonialFireworksDef.hidden = false;
		ItemAPI.Add(new CustomItem(CeremonialFireworksDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
		LanguageAPI.Add("CF", "Ceremonial Fireworks");
		LanguageAPI.Add("CF_Pickup", "Chance to launch fireworks on kill");
		LanguageAPI.Add("CF_Desc", $"<style=cIsUtility>{BasePercentage}%</style> chance to launch {BaseFireworkNum} <style=cStack>(+{ScalingFireworkNum} per stack)</style> fireworks on <style=cIsDamage>enemy kill</style> that deal <style=cIsUtility>300%</style> base damage");
		LanguageAPI.Add("CF_Lore", "When daggers aren't explosive enough");
	}

	private static void Hooks()
	{
		GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
		{
			SpawnFireworks(report);
		};
	}

	private static void SpawnFireworks(DamageReport report)
	{
		//IL_0069: 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)
		if (!Utils.DamageReportNullCheck(report))
		{
			int itemCount = report.attackerBody.inventory.GetItemCount(CeremonialFireworksDef);
			if (itemCount > 0 && Util.CheckRoll((float)BasePercentage, report.attackerBody.master))
			{
				int remaining = BaseFireworkNum + (itemCount - 1) * ScalingFireworkNum;
				FireworkLauncher component = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/FireworkLauncher"), report.victimBody.corePosition, Quaternion.identity).GetComponent<FireworkLauncher>();
				component.owner = ((Component)report.attackerBody).gameObject;
				component.crit = Util.CheckRoll(report.attackerBody.crit, report.attackerBody.master);
				component.remaining = remaining;
			}
		}
	}
}
internal class Prowler
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Action<DamageReport> <>9__14_0;

		public static hook_OnBodyDamaged <>9__14_1;

		public static hook_RecalculateStats <>9__14_2;

		internal void <Hooks>b__14_0(DamageReport report)
		{
			ProwlerCleanse(report);
		}

		internal void <Hooks>b__14_1(orig_OnBodyDamaged orig, CharacterMaster self, DamageReport report)
		{
			RemoveNextCrit(report);
			orig.Invoke(self, report);
		}

		internal void <Hooks>b__14_2(orig_RecalculateStats orig, CharacterBody self)
		{
			AddNextCrit(self);
			orig.Invoke(self);
		}
	}

	internal static AssetBundle Bundle;

	public static ConfigFile Config;

	private static ItemDef ProwlerDef;

	private static BuffDef NextCrit;

	private static readonly int BasePercentage = 40;

	private static readonly int ScalingPercentage = 25;

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

	internal static void Init()
	{
		Config = NewtDrop.NewtConfig;
		Bundle = NewtDrop.bundle;
		CreateConfig();
		if (ProwlerConfig.Value)
		{
			CreateItem();
			CreateBuffs();
			Hooks();
		}
	}

	private static void CreateConfig()
	{
		ProwlerConfig = Config.Bind<bool>("Items", "Prowler", true, "Enable this item?");
	}

	private static void CreateItem()
	{
		//IL_005d: 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_00b5: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		ProwlerDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)ProwlerDef).name = "Prowler";
		ProwlerDef.nameToken = "Prowler_Name";
		ProwlerDef.descriptionToken = "Prowler_Desc";
		ProwlerDef.loreToken = "Prowler_Lore";
		ProwlerDef.pickupToken = "Prowler_Pickup";
		ProwlerDef.deprecatedTier = (ItemTier)2;
		ProwlerDef.pickupIconSprite = Bundle.LoadAsset<Sprite>("Assets/Prowler.png");
		ProwlerDef.pickupModelPrefab = Resources.Load<GameObject>("Prefabs/PickupModels/PickupFireballsOnHit");
		ProwlerDef.canRemove = true;
		ProwlerDef.hidden = false;
		ItemAPI.Add(new CustomItem(ProwlerDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
		LanguageAPI.Add("Prowler_Name", "Prowler");
		LanguageAPI.Add("Prowler_Pickup", "On elite kill, crit next target and gain a chance to cleanse all debuffs");
		LanguageAPI.Add("Prowler_Desc", $"On elite kill, gain <style=cIsUtility>+100%</style> crit chance for next attack, and get <style=cIsUtility>{BasePercentage}%</style> <style=cStack>(+{ScalingPercentage}% per stack)</style> chance to cleanse all debuffs");
		LanguageAPI.Add("Prowler_Lore", "Chain those band procs");
	}

	private static void CreateBuffs()
	{
		//IL_0020: 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)
		NextCrit = ScriptableObject.CreateInstance<BuffDef>();
		((Object)NextCrit).name = "NextCrit";
		NextCrit.buffColor = Color.red;
		NextCrit.canStack = false;
		NextCrit.isDebuff = false;
		NextCrit.iconSprite = Resources.Load<Sprite>("Textures/ItemIcons/texGlassesIcon");
		ContentAddition.AddBuffDef(NextCrit);
	}

	private static void Hooks()
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
		{
			ProwlerCleanse(report);
		};
		object obj = <>c.<>9__14_1;
		if (obj == null)
		{
			hook_OnBodyDamaged val = delegate(orig_OnBodyDamaged orig, CharacterMaster self, DamageReport report)
			{
				RemoveNextCrit(report);
				orig.Invoke(self, report);
			};
			<>c.<>9__14_1 = val;
			obj = (object)val;
		}
		CharacterMaster.OnBodyDamaged += (hook_OnBodyDamaged)obj;
		object obj2 = <>c.<>9__14_2;
		if (obj2 == null)
		{
			hook_RecalculateStats val2 = delegate(orig_RecalculateStats orig, CharacterBody self)
			{
				AddNextCrit(self);
				orig.Invoke(self);
			};
			<>c.<>9__14_2 = val2;
			obj2 = (object)val2;
		}
		CharacterBody.RecalculateStats += (hook_RecalculateStats)obj2;
	}

	private static void ProwlerCleanse(DamageReport report)
	{
		if (Utils.DamageReportNullCheck(report))
		{
			return;
		}
		int itemCount = report.attackerBody.inventory.GetItemCount(ProwlerDef);
		if (itemCount > 0 && report.victimBody.isElite)
		{
			if (Util.CheckRoll((float)(BasePercentage + (itemCount - 1) * ScalingPercentage), report.attackerBody.master))
			{
				Util.CleanseBody(report.attackerBody, true, false, true, true, true, false);
				report.attackerBody.AddBuff(Buffs.ElementalRingsReady);
			}
			report.attackerBody.AddBuff(NextCrit);
		}
	}

	private static void RemoveNextCrit(DamageReport report)
	{
		if (!Utils.DamageReportNullCheck(report) && report.attackerBody.HasBuff(NextCrit))
		{
			report.attackerBody.RemoveBuff(NextCrit);
		}
	}

	private static void AddNextCrit(CharacterBody body)
	{
		if (body.HasBuff(NextCrit))
		{
			body.crit += 100f;
		}
	}
}
internal class ShieldBow
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnBodyDamaged <>9__20_0;

		public static hook_RecalculateStats <>9__20_1;

		internal void <Hooks>b__20_0(orig_OnBodyDamaged orig, CharacterMaster self, DamageReport report)
		{
			LifeLine(report);
			LifeStealBuff(report);
			orig.Invoke(self, report);
		}

		internal void <Hooks>b__20_1(orig_RecalculateStats orig, CharacterBody self)
		{
			ArmorBuff(self);
			orig.Invoke(self);
		}
	}

	internal static AssetBundle Bundle;

	public static ConfigFile Config;

	private static ItemDef ShieldBowDef;

	private static BuffDef ShieldBuff;

	private static BuffDef LifeVamp;

	private static readonly int BaseLifeStealDurationSecs = 5;

	private static readonly int ScalingLifeStealDurationSecs = 5;

	private static readonly int BaseArmor = 100;

	private static readonly int CooldownSecs = 20;

	private static readonly float TriggerFraction = 0.4f;

	private static readonly float BarrierFraction = 0.4f;

	private static readonly float LifeStealDamageFraction = 0.2f;

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

	internal static void Init()
	{
		Config = NewtDrop.NewtConfig;
		Bundle = NewtDrop.bundle;
		CreateConfig();
		if (ShieldBowConfig.Value)
		{
			CreateItem();
			CreateBuffs();
			Hooks();
		}
	}

	private static void CreateConfig()
	{
		ShieldBowConfig = Config.Bind<bool>("Items", "ShieldBow", true, "Enable this item?");
	}

	private static void CreateItem()
	{
		//IL_005d: 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_00b5: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		ShieldBowDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)ShieldBowDef).name = "ShieldBow";
		ShieldBowDef.nameToken = "SB";
		ShieldBowDef.descriptionToken = "SB_Desc";
		ShieldBowDef.loreToken = "SB_Lore";
		ShieldBowDef.pickupToken = "SB_Pickup";
		ShieldBowDef.deprecatedTier = (ItemTier)2;
		ShieldBowDef.pickupIconSprite = Bundle.LoadAsset<Sprite>("Assets/ShieldBow.png");
		ShieldBowDef.pickupModelPrefab = Resources.Load<GameObject>("Prefabs/PickupModels/PickupBuckler");
		ShieldBowDef.canRemove = true;
		ShieldBowDef.hidden = false;
		ItemAPI.Add(new CustomItem(ShieldBowDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
		LanguageAPI.Add("SB", "ShieldBow");
		LanguageAPI.Add("SB_Pickup", "Gain barrier and lifesteal when health is low");
		LanguageAPI.Add("SB_Desc", $"Whenever you drop below <style=cIsUtility>{TriggerFraction * 100f}%</style> health, gain a shield for <style=cIsUtility>{BarrierFraction * 100f}%</style> of your maximum health and gain <style=cIsUtility>{LifeStealDamageFraction * 100f}%</style> lifesteal for <style=cIsUtility>{BaseLifeStealDurationSecs}s</style> <style=cStack>(+{ScalingLifeStealDurationSecs}s per stack)</style>. ({CooldownSecs}s cooldown)  While on cooldown, gain <style=cIsUtility>{BaseArmor}</style> armor");
		LanguageAPI.Add("SB_Lore", "Yes, this is from League. Note: does not trigger from fall damage");
	}

	private static void CreateBuffs()
	{
		//IL_0020: 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_007e: 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)
		ShieldBuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)ShieldBuff).name = "ShieldBuff";
		ShieldBuff.buffColor = Color.cyan;
		ShieldBuff.canStack = false;
		ShieldBuff.isDebuff = true;
		ShieldBuff.iconSprite = Resources.Load<Sprite>("Textures/ItemIcons/texBucklerIcon");
		ContentAddition.AddBuffDef(ShieldBuff);
		LifeVamp = ScriptableObject.CreateInstance<BuffDef>();
		((Object)LifeVamp).name = "LifeVamp";
		LifeVamp.buffColor = Color.red;
		LifeVamp.canStack = false;
		LifeVamp.isDebuff = false;
		LifeVamp.iconSprite = Resources.Load<Sprite>("textures/itemicons/texScytheIcon");
		ContentAddition.AddBuffDef(LifeVamp);
	}

	private static void Hooks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		object obj = <>c.<>9__20_0;
		if (obj == null)
		{
			hook_OnBodyDamaged val = delegate(orig_OnBodyDamaged orig, CharacterMaster self, DamageReport report)
			{
				LifeLine(report);
				LifeStealBuff(report);
				orig.Invoke(self, report);
			};
			<>c.<>9__20_0 = val;
			obj = (object)val;
		}
		CharacterMaster.OnBodyDamaged += (hook_OnBodyDamaged)obj;
		object obj2 = <>c.<>9__20_1;
		if (obj2 == null)
		{
			hook_RecalculateStats val2 = delegate(orig_RecalculateStats orig, CharacterBody self)
			{
				ArmorBuff(self);
				orig.Invoke(self);
			};
			<>c.<>9__20_1 = val2;
			obj2 = (object)val2;
		}
		CharacterBody.RecalculateStats += (hook_RecalculateStats)obj2;
	}

	private static void LifeLine(DamageReport report)
	{
		if (!Utils.DamageReportNullCheck(report))
		{
			int itemCount = report.victimBody.inventory.GetItemCount(ShieldBowDef);
			if (itemCount > 0 && report.victimBody.healthComponent.health / report.victimBody.maxHealth <= TriggerFraction && !report.victimBody.HasBuff(ShieldBuff))
			{
				report.victimBody.healthComponent.AddBarrier(BarrierFraction * report.victimBody.maxHealth);
				report.victimBody.AddTimedBuff(LifeVamp, (float)(BaseLifeStealDurationSecs + (itemCount - 1) * ScalingLifeStealDurationSecs));
				report.victimBody.AddTimedBuff(ShieldBuff, (float)CooldownSecs);
				report.victimBody.RecalculateStats();
			}
		}
	}

	private static void LifeStealBuff(DamageReport report)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		if (!Utils.DamageReportNullCheck(report) && report.attackerBody.HasBuff(LifeVamp))
		{
			report.attackerBody.healthComponent.Heal(report.damageDealt * LifeStealDamageFraction, report.damageInfo.procChainMask, true);
		}
	}

	private static void ArmorBuff(CharacterBody person)
	{
		if (!((Object)(object)person == (Object)null) && person.HasBuff(ShieldBuff))
		{
			person.armor += (float)BaseArmor;
		}
	}
}
internal class PureTonic
{
	internal static AssetBundle Bundle;

	public static ConfigFile Config;

	private static ItemDef PureTonicDef;

	private static readonly int BasePercentage = 60;

	private static readonly int BaseDurationSec = 3;

	private static readonly int ScalingPercentage = 40;

	private static readonly int ScalingDurationSec = 3;

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

	internal static void Init()
	{
		Config = NewtDrop.NewtConfig;
		Bundle = NewtDrop.bundle;
		CreateConfig();
		if (PureTonicConfig.Value)
		{
			CreateItem();
			Hooks();
		}
	}

	private static void CreateConfig()
	{
		PureTonicConfig = Config.Bind<bool>("Items", "Purified Tonic", true, "Enable this item?");
	}

	private static void CreateItem()
	{
		//IL_005d: 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_00b5: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		PureTonicDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)PureTonicDef).name = "PureTonic";
		PureTonicDef.nameToken = "PureTonic";
		PureTonicDef.descriptionToken = "PureTonic_Desc";
		PureTonicDef.loreToken = "PureTonic_Lore";
		PureTonicDef.pickupToken = "PureTonic_Pickup";
		PureTonicDef.deprecatedTier = (ItemTier)2;
		PureTonicDef.pickupIconSprite = Bundle.LoadAsset<Sprite>("Assets/PureTonic.png");
		PureTonicDef.pickupModelPrefab = Resources.Load<GameObject>("Prefabs/PickupModels/PickupTonic");
		PureTonicDef.canRemove = true;
		PureTonicDef.hidden = false;
		ItemAPI.Add(new CustomItem(PureTonicDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
		LanguageAPI.Add("PureTonic", "Purified Tonic");
		LanguageAPI.Add("PureTonic_Pickup", "Chance to use tonic on kill without getting debuffed");
		LanguageAPI.Add("PureTonic_Desc", $"Whenever you <style=cIsDamage>kill an enemy</style>, you have a <style=cIsUtility>{BasePercentage}%</style> <style=cStack>(+{ScalingPercentage}% per stack)</style> chance to use tonic without chance of debuff for <style=cIsUtility>{BaseDurationSec}s</style> <style=cStack>(+{ScalingDurationSec}s per stack)</style>.");
		LanguageAPI.Add("PureTonic_Lore", "Harder, better, faster, stronger");
	}

	private static void Hooks()
	{
		GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
		{
			GiveTonic(report);
		};
	}

	private static void GiveTonic(DamageReport report)
	{
		if (!Utils.DamageReportNullCheck(report))
		{
			int itemCount = report.attackerBody.inventory.GetItemCount(PureTonicDef);
			if (itemCount > 0 && Util.CheckRoll((float)(BasePercentage + (itemCount - 1) * ScalingPercentage), report.attackerBody.master))
			{
				report.attackerBody.AddTimedBuff(Buffs.TonicBuff, (float)(BaseDurationSec + (itemCount - 1) * ScalingDurationSec));
			}
		}
	}
}
internal class Utils
{
	public static bool DamageReportNullCheck(DamageReport report)
	{
		return report == null || (Object)(object)report.attacker == (Object)null || !Object.op_Implicit((Object)(object)report.attacker) || !Object.op_Implicit((Object)(object)report.attackerBody) || !Object.op_Implicit((Object)(object)report.attackerBody.inventory) || (Object)(object)report.victim == (Object)null || !Object.op_Implicit((Object)(object)report.victimBody) || !Object.op_Implicit((Object)(object)report.victimBody.inventory);
	}
}
internal class ShopKeeperTweak
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_Start <>9__8_0;

		public static hook_Start <>9__8_1;

		public static Action<DamageReport> <>9__8_2;

		internal void <Hooks>b__8_0(orig_Start orig, Run self)
		{
			gotDrop = false;
			orig.Invoke(self);
		}

		internal void <Hooks>b__8_1(orig_Start orig, CharacterBody self)
		{
			ChangeNewtHealth(self);
			orig.Invoke(self);
		}

		internal void <Hooks>b__8_2(DamageReport report)
		{
			SpawnPearls(report);
		}
	}

	public static ConfigFile Config;

	private static bool gotDrop;

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

	internal static void Init()
	{
		gotDrop = false;
		Config = NewtDrop.NewtConfig;
		CreateConfig();
		Hooks();
	}

	private static void CreateConfig()
	{
		NewtHealthMultiplier = Config.Bind<float>("Tweak", "Newt Health Multiplier", 1f, "Multiplier for the Shopkeeper's max health. Default: 1");
	}

	private static void Hooks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		object obj = <>c.<>9__8_0;
		if (obj == null)
		{
			hook_Start val = delegate(orig_Start orig, Run self)
			{
				gotDrop = false;
				orig.Invoke(self);
			};
			<>c.<>9__8_0 = val;
			obj = (object)val;
		}
		Run.Start += (hook_Start)obj;
		object obj2 = <>c.<>9__8_1;
		if (obj2 == null)
		{
			hook_Start val2 = delegate(orig_Start orig, CharacterBody self)
			{
				ChangeNewtHealth(self);
				orig.Invoke(self);
			};
			<>c.<>9__8_1 = val2;
			obj2 = (object)val2;
		}
		CharacterBody.Start += (hook_Start)obj2;
		GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
		{
			SpawnPearls(report);
		};
	}

	private static void ChangeNewtHealth(CharacterBody person)
	{
		//IL_0013: 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)
		if (NewtHealthMultiplier.Value != 1f && person.bodyIndex == BodyCatalog.FindBodyIndex("ShopkeeperBody"))
		{
			HealthComponent healthComponent = person.healthComponent;
			healthComponent.health *= NewtHealthMultiplier.Value;
			person.baseMaxHealth *= NewtHealthMultiplier.Value;
			person.levelMaxHealth *= NewtHealthMultiplier.Value;
			person.maxHealth *= NewtHealthMultiplier.Value;
			person.RecalculateStats();
		}
	}

	private static void SpawnPearls(DamageReport report)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody victimBody = report.victimBody;
		if ((Object)(object)victimBody != (Object)null && victimBody.bodyIndex == BodyCatalog.FindBodyIndex("ShopkeeperBody"))
		{
			if (gotDrop)
			{
				PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items.Pearl.itemIndex), victimBody.transform.position, Vector3.up * 20f);
				return;
			}
			PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items.ShinyPearl.itemIndex), victimBody.transform.position, Vector3.up * 20f);
			gotDrop = true;
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.BoneCap.NewtDrop", "NewtDrop", "2.0.0")]
[R2APISubmoduleDependency(new string[] { "ItemAPI", "LanguageAPI" })]
public class NewtDrop : BaseUnityPlugin
{
	public static ManualLogSource Log;

	public GameObject multiShopPrefab;

	public ItemTier[] itemTiers;

	internal static AssetBundle bundle;

	public static ConfigFile NewtConfig { get; set; }

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

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

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

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

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

	public void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		NewtConfig = ((BaseUnityPlugin)this).Config;
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NewtDrop.newt_drop_assets"))
		{
			bundle = AssetBundle.LoadFromStream(stream);
			bundle.LoadAllAssets();
		}
		ShopKeeperTweak.Init();
		CeremonialFireworks.Init();
		PureTonic.Init();
		ShieldBow.Init();
		Prowler.Init();
	}
}