Decompiled source of CromulentItems v0.4.0

CromulentItems.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CromulentItems;
using HG.Reflection;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public static class Assets
{
	public static AssetBundle icons;

	public static AssetBundle prefabs;

	public const string iconsName = "iconsCrom";

	public const string prefabsName = "prefabsCrom";

	public static string IconAssetBundlePath => Path.Combine(Path.GetDirectoryName(CromItems.PInfo.Location), "iconsCrom");

	public static string PrefabAssetBundlePath => Path.Combine(Path.GetDirectoryName(CromItems.PInfo.Location), "prefabsCrom");

	public static void Init()
	{
		icons = AssetBundle.LoadFromFile(IconAssetBundlePath);
		prefabs = AssetBundle.LoadFromFile(PrefabAssetBundlePath);
	}
}
namespace CromulentItems;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Spartan.CromulentItems", "CromulentItems", "0.3.0")]
[R2APISubmoduleDependency(new string[] { "ItemAPI", "LanguageAPI" })]
public class CromItems : BaseUnityPlugin
{
	public const string PluginGUID = "Spartan.CromulentItems";

	public const string PluginAuthor = "Spartan";

	public const string PluginName = "CromulentItems";

	public const string PluginVersion = "0.3.0";

	public static ManualLogSource Log;

	public GameObject multiShopPrefab;

	public ItemTier[] itemTiers;

	public static PluginInfo PInfo { get; private set; }

	public void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		PInfo = ((BaseUnityPlugin)this).Info;
		Assets.Init();
		JacobBlast.Init();
		Grug.Init();
		Respect.Init();
		WoatReaction.Init();
		ThanosGen.Init();
		Log.LogInfo((object)"CromulentItems successfully loaded.");
	}

	private void Update()
	{
	}
}
internal class Grug
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnCharacterDeath <>9__6_0;

		public static hook_OnHitEnemy <>9__6_1;

		internal void <hooks>b__6_0(orig_OnCharacterDeath orig, GlobalEventManager globalEventManager, DamageReport damageReport)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(globalEventManager, damageReport);
			CharacterMaster attackerMaster = damageReport.attackerMaster;
			if ((Object)(object)((attackerMaster != null) ? attackerMaster.inventory : null) != (Object)null)
			{
				int itemCount = damageReport.attackerMaster.inventory.GetItemCount(myItemDef.itemIndex);
				if (!(damageReport.attacker.GetComponent<CharacterBody>().healthComponent.barrier > 0f) && itemCount > 0)
				{
					damageReport.attacker.GetComponent<CharacterBody>().healthComponent.AddBarrier(15f);
				}
			}
		}

		internal void <hooks>b__6_1(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, victim);
			if (!Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			CharacterBody component2 = victim.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)((component != null) ? component.inventory : null)))
			{
				int itemCount = component.inventory.GetItemCount(myItemDef.itemIndex);
				_ = component2.transform.position;
				if (itemCount > 0 && component.healthComponent.barrier > 0f && Util.CheckRoll(20f * damageInfo.procCoefficient, 0f, (CharacterMaster)null))
				{
					component.AddBuff(myCounterBuffDef);
					float num = 2f * (float)itemCount;
					float num2 = Util.OnHitProcDamage(damageInfo.damage, component.damage, num);
					MissileUtils.FireMissile(component.corePosition, component, damageInfo.procChainMask, victim, num2, false, CommonAssets.missilePrefab, (DamageColorIndex)3, false);
				}
			}
		}
	}

	public static ItemDef myItemDef;

	public static GameObject RockProjectile;

	public static GameObject RockGhost;

	public static BuffDef myCounterBuffDef;

	internal static void Init()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		CreateItem();
		AddTokens();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(myItemDef, val));
		hooks();
	}

	private static void CreateItem()
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		myItemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)myItemDef).name = "Grug";
		myItemDef.nameToken = "Grug";
		myItemDef.pickupToken = "GrugItem";
		myItemDef.descriptionToken = "GrugDesc";
		myItemDef.loreToken = "GrugDesc";
		myItemDef.tags = (ItemTag[])(object)new ItemTag[2]
		{
			(ItemTag)2,
			(ItemTag)1
		};
		myItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion();
		Sprite pickupIconSprite = Assets.icons.LoadAsset<Sprite>("Grug");
		myItemDef.pickupIconSprite = pickupIconSprite;
		GameObject pickupModelPrefab = Assets.prefabs.LoadAsset<GameObject>("GrugCube");
		myItemDef.pickupModelPrefab = pickupModelPrefab;
		RockProjectile = Assets.prefabs.LoadAsset<GameObject>("rock");
		myItemDef.canRemove = true;
		myItemDef.hidden = false;
	}

	private static void hooks()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		object obj = <>c.<>9__6_0;
		if (obj == null)
		{
			hook_OnCharacterDeath val = delegate(orig_OnCharacterDeath orig, GlobalEventManager globalEventManager, DamageReport damageReport)
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(globalEventManager, damageReport);
				CharacterMaster attackerMaster = damageReport.attackerMaster;
				if ((Object)(object)((attackerMaster != null) ? attackerMaster.inventory : null) != (Object)null)
				{
					int itemCount2 = damageReport.attackerMaster.inventory.GetItemCount(myItemDef.itemIndex);
					if (!(damageReport.attacker.GetComponent<CharacterBody>().healthComponent.barrier > 0f) && itemCount2 > 0)
					{
						damageReport.attacker.GetComponent<CharacterBody>().healthComponent.AddBarrier(15f);
					}
				}
			};
			<>c.<>9__6_0 = val;
			obj = (object)val;
		}
		GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj;
		object obj2 = <>c.<>9__6_1;
		if (obj2 == null)
		{
			hook_OnHitEnemy val2 = delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, damageInfo, victim);
				if (Object.op_Implicit((Object)(object)damageInfo.attacker))
				{
					CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
					CharacterBody component2 = victim.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)((component != null) ? component.inventory : null)))
					{
						int itemCount = component.inventory.GetItemCount(myItemDef.itemIndex);
						_ = component2.transform.position;
						if (itemCount > 0 && component.healthComponent.barrier > 0f && Util.CheckRoll(20f * damageInfo.procCoefficient, 0f, (CharacterMaster)null))
						{
							component.AddBuff(myCounterBuffDef);
							float num = 2f * (float)itemCount;
							float num2 = Util.OnHitProcDamage(damageInfo.damage, component.damage, num);
							MissileUtils.FireMissile(component.corePosition, component, damageInfo.procChainMask, victim, num2, false, CommonAssets.missilePrefab, (DamageColorIndex)3, false);
						}
					}
				}
			};
			<>c.<>9__6_1 = val2;
			obj2 = (object)val2;
		}
		GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj2;
	}

	private static void AddTokens()
	{
		LanguageAPI.Add("Grug", "grug...");
		LanguageAPI.Add("GrugItem", "Gain barrier. \nOn hit, rock(et)");
		LanguageAPI.Add("GrugDesc", "On kill, gain a barrier if you dont have one.\nOn hit if you have a barrier, <style=cIsUtility>20%<style=cIsUtility> chance to launch a rock(et) that does <style=cIsUtility>+" + 300 + "%<style=cIsUtility><style=cStack>(+" + 300 + "%)</style> damage.");
		LanguageAPI.Add("GrugLore", "He's grug you know");
	}
}
internal class JacobBlast
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnInventoryChanged <>9__6_0;

		public static hook_OnHitEnemy <>9__6_1;

		internal void <hooks>b__6_0(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
		}

		internal void <hooks>b__6_1(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, victim);
			if (!Object.op_Implicit((Object)(object)damageInfo.attacker) || !(damageInfo.procCoefficient > 0f))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			victim.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)((component != null) ? component.inventory : null)))
			{
				int itemCount = component.inventory.GetItemCount(myItemDef.itemIndex);
				if (itemCount > 0 && Util.CheckRoll(3f + 1f * (float)itemCount - 1f, component.master))
				{
					component.AddTimedBuff(Buffs.TonicBuff, 3f + 1f * (float)itemCount - 1f);
				}
			}
		}
	}

	public static ItemDef myItemDef;

	public static float luckAmount = 10f;

	public static float numItems = 0f;

	public static float cooldownAmount = 0.70000005f;

	internal static void Init()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		CreateItem();
		AddTokens();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(myItemDef, val));
		hooks();
	}

	private static void CreateItem()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		myItemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)myItemDef).name = "JacobBlast";
		myItemDef.nameToken = "JacobBlast";
		myItemDef.pickupToken = "JacobBlastItem";
		myItemDef.descriptionToken = "JacobBlastDesc";
		myItemDef.loreToken = "JacobBlastDesc";
		myItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 };
		myItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier3Def.asset").WaitForCompletion();
		Sprite pickupIconSprite = Assets.icons.LoadAsset<Sprite>("JacobBluePNG");
		myItemDef.pickupIconSprite = pickupIconSprite;
		GameObject pickupModelPrefab = Assets.prefabs.LoadAsset<GameObject>("JacobCube");
		myItemDef.pickupModelPrefab = pickupModelPrefab;
		myItemDef.canRemove = true;
		myItemDef.hidden = false;
	}

	private static void hooks()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		object obj = <>c.<>9__6_0;
		if (obj == null)
		{
			hook_OnInventoryChanged val = delegate(orig_OnInventoryChanged orig, CharacterBody self)
			{
				orig.Invoke(self);
			};
			<>c.<>9__6_0 = val;
			obj = (object)val;
		}
		CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)obj;
		object obj2 = <>c.<>9__6_1;
		if (obj2 == null)
		{
			hook_OnHitEnemy val2 = delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
			{
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, damageInfo, victim);
				if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.procCoefficient > 0f)
				{
					CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
					victim.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)((component != null) ? component.inventory : null)))
					{
						int itemCount = component.inventory.GetItemCount(myItemDef.itemIndex);
						if (itemCount > 0 && Util.CheckRoll(3f + 1f * (float)itemCount - 1f, component.master))
						{
							component.AddTimedBuff(Buffs.TonicBuff, 3f + 1f * (float)itemCount - 1f);
						}
					}
				}
			};
			<>c.<>9__6_1 = val2;
			obj2 = (object)val2;
		}
		GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj2;
	}

	private static void AddTokens()
	{
		LanguageAPI.Add("JacobBlast", "Jacob Blast");
		LanguageAPI.Add("JacobBlastItem", "Chance to activate 'Tonic' on hit");
		LanguageAPI.Add("JacobBlastDesc", " <style=cIsUtility>" + 3 + "% (+" + 1 + "%)</style> chance to Activate a Tonic Effect for <style=cIsUtility>\" + 3 + \" (+\" + 1 + \")</style> seconds.");
		LanguageAPI.Add("JacobBlastLore", "Blue Liquid Amalgomation");
	}
}
internal class Respect
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnHitEnemy <>9__3_0;

		internal void <hooks>b__3_0(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				victim.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)((component != null) ? component.inventory : null)))
				{
					int itemCount = component.inventory.GetItemCount(myItemDef.itemIndex);
					if (itemCount > 0 && damageInfo.procCoefficient > 0f)
					{
						float num = 0.03f * (float)itemCount;
						damageInfo.procCoefficient += num;
					}
				}
			}
			orig.Invoke(self, damageInfo, victim);
		}
	}

	public static ItemDef myItemDef;

	internal static void Init()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		CreateItem();
		AddTokens();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(myItemDef, val));
		hooks();
	}

	private static void CreateItem()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		myItemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)myItemDef).name = "Respect";
		myItemDef.nameToken = "Respect";
		myItemDef.pickupToken = "RespectItem";
		myItemDef.descriptionToken = "RespectDesc";
		myItemDef.loreToken = "RespectDesc";
		myItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 };
		myItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier1Def.asset").WaitForCompletion();
		Sprite pickupIconSprite = Assets.icons.LoadAsset<Sprite>("respectPNG");
		myItemDef.pickupIconSprite = pickupIconSprite;
		GameObject pickupModelPrefab = Assets.prefabs.LoadAsset<GameObject>("RespectOBJ");
		myItemDef.pickupModelPrefab = pickupModelPrefab;
		myItemDef.canRemove = true;
		myItemDef.hidden = false;
	}

	private static void hooks()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		object obj = <>c.<>9__3_0;
		if (obj == null)
		{
			hook_OnHitEnemy val = delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)damageInfo.attacker))
				{
					CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
					victim.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)((component != null) ? component.inventory : null)))
					{
						int itemCount = component.inventory.GetItemCount(myItemDef.itemIndex);
						if (itemCount > 0 && damageInfo.procCoefficient > 0f)
						{
							float num = 0.03f * (float)itemCount;
							damageInfo.procCoefficient += num;
						}
					}
				}
				orig.Invoke(self, damageInfo, victim);
			};
			<>c.<>9__3_0 = val;
			obj = (object)val;
		}
		GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj;
	}

	private static void AddTokens()
	{
		LanguageAPI.Add("Respect", "Respect");
		LanguageAPI.Add("RespectItem", "Slightly increase proc coefficient");
		LanguageAPI.Add("RespectDesc", "Gain <style=cIsUtility>+" + 3 + "%</style><style=cStack>(+" + 3 + "%)</style> proc coefficient");
		LanguageAPI.Add("RespectLore", "#1 Star of Thats Respect Compilations");
	}
}
internal class ThanosGen
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Action<AsyncOperationHandle<PickupDropTable>> <>9__2_0;

		public static hook_OnCharacterDeath <>9__4_0;

		internal void <Init>b__2_0(AsyncOperationHandle<PickupDropTable> x)
		{
			thanosDrops = x.Result;
		}

		internal void <hooks>b__4_0(orig_OnCharacterDeath orig, GlobalEventManager globalEventManager, DamageReport damageReport)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(globalEventManager, damageReport);
			Vector3 val = Vector3.zero;
			Quaternion val2 = Quaternion.identity;
			if (Object.op_Implicit((Object)(object)damageReport.victim))
			{
				val = ((Component)damageReport.victim).transform.position;
				val2 = ((Component)damageReport.victim).transform.rotation;
			}
			InputBankTest inputBank = damageReport.victimBody.inputBank;
			Ray val3 = (Ray)(Object.op_Implicit((Object)(object)inputBank) ? inputBank.GetAimRay() : new Ray(val, val2 * Vector3.forward));
			CharacterMaster attackerMaster = damageReport.attackerMaster;
			if (!((Object)(object)((attackerMaster != null) ? attackerMaster.inventory : null) != (Object)null))
			{
				return;
			}
			int itemCount = damageReport.attackerMaster.inventory.GetItemCount(myItemDef.itemIndex);
			if (itemCount > 0)
			{
				if (damageReport.victimBody.isChampion && Util.CheckRoll(100f, damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.victimBody))
				{
					PickupDropletController.CreatePickupDroplet(thanosDrops.GenerateDrop(Run.instance.runRNG), val + Vector3.up * 1.5f, Vector3.up * 20f + ((Ray)(ref val3)).direction * 2f);
				}
				else if (damageReport.victimBody.isElite && Util.CheckRoll(1f + 3f * (float)itemCount, damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.victimBody))
				{
					PickupDropletController.CreatePickupDroplet(thanosDrops.GenerateDrop(Run.instance.runRNG), val + Vector3.up * 1.5f, Vector3.up * 20f + ((Ray)(ref val3)).direction * 2f);
				}
				else if (Object.op_Implicit((Object)(object)damageReport.victimBody) && Util.CheckRoll(1f + 1f * (float)itemCount, damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.victimBody))
				{
					PickupDropletController.CreatePickupDroplet(thanosDrops.GenerateDrop(Run.instance.runRNG), val + Vector3.up * 1.5f, Vector3.up * 20f + ((Ray)(ref val3)).direction * 2f);
				}
			}
		}
	}

	public static ItemDef myItemDef;

	public static PickupDropTable thanosDrops;

	internal static void Init()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		CreateItem();
		AddTokens();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		AsyncOperationHandle<PickupDropTable> val2 = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/DLC2/Items/ResetChests/dtSonorousEcho.asset");
		val2.Completed += delegate(AsyncOperationHandle<PickupDropTable> x)
		{
			thanosDrops = x.Result;
		};
		ItemAPI.Add(new CustomItem(myItemDef, val));
		hooks();
	}

	private static void CreateItem()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		myItemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)myItemDef).name = "ThanosGen";
		myItemDef.nameToken = "ThanosGen";
		myItemDef.pickupToken = "ThanosGenItem";
		myItemDef.descriptionToken = "ThanosGenDesc";
		myItemDef.loreToken = "ThanosGenDesc";
		myItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 };
		myItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier3Def.asset").WaitForCompletion();
		Sprite pickupIconSprite = Assets.icons.LoadAsset<Sprite>("thanosGen");
		myItemDef.pickupIconSprite = pickupIconSprite;
		GameObject pickupModelPrefab = Assets.prefabs.LoadAsset<GameObject>("ThanosGen");
		myItemDef.pickupModelPrefab = pickupModelPrefab;
		myItemDef.canRemove = true;
		myItemDef.hidden = false;
	}

	private static void hooks()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		object obj = <>c.<>9__4_0;
		if (obj == null)
		{
			hook_OnCharacterDeath val = delegate(orig_OnCharacterDeath orig, GlobalEventManager globalEventManager, DamageReport damageReport)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: 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_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: 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_0211: Unknown result type (might be due to invalid IL or missing references)
				//IL_0216: Unknown result type (might be due to invalid IL or missing references)
				//IL_021b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(globalEventManager, damageReport);
				Vector3 val2 = Vector3.zero;
				Quaternion val3 = Quaternion.identity;
				if (Object.op_Implicit((Object)(object)damageReport.victim))
				{
					val2 = ((Component)damageReport.victim).transform.position;
					val3 = ((Component)damageReport.victim).transform.rotation;
				}
				InputBankTest inputBank = damageReport.victimBody.inputBank;
				Ray val4 = (Ray)(Object.op_Implicit((Object)(object)inputBank) ? inputBank.GetAimRay() : new Ray(val2, val3 * Vector3.forward));
				CharacterMaster attackerMaster = damageReport.attackerMaster;
				if ((Object)(object)((attackerMaster != null) ? attackerMaster.inventory : null) != (Object)null)
				{
					int itemCount = damageReport.attackerMaster.inventory.GetItemCount(myItemDef.itemIndex);
					if (itemCount > 0)
					{
						if (damageReport.victimBody.isChampion && Util.CheckRoll(100f, damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.victimBody))
						{
							PickupDropletController.CreatePickupDroplet(thanosDrops.GenerateDrop(Run.instance.runRNG), val2 + Vector3.up * 1.5f, Vector3.up * 20f + ((Ray)(ref val4)).direction * 2f);
						}
						else if (damageReport.victimBody.isElite && Util.CheckRoll(1f + 3f * (float)itemCount, damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.victimBody))
						{
							PickupDropletController.CreatePickupDroplet(thanosDrops.GenerateDrop(Run.instance.runRNG), val2 + Vector3.up * 1.5f, Vector3.up * 20f + ((Ray)(ref val4)).direction * 2f);
						}
						else if (Object.op_Implicit((Object)(object)damageReport.victimBody) && Util.CheckRoll(1f + 1f * (float)itemCount, damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.victimBody))
						{
							PickupDropletController.CreatePickupDroplet(thanosDrops.GenerateDrop(Run.instance.runRNG), val2 + Vector3.up * 1.5f, Vector3.up * 20f + ((Ray)(ref val4)).direction * 2f);
						}
					}
				}
			};
			<>c.<>9__4_0 = val;
			obj = (object)val;
		}
		GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj;
	}

	private static void AddTokens()
	{
		LanguageAPI.Add("ThanosGen", "AI Generated Thanos");
		LanguageAPI.Add("ThanosGenItem", "Chance For An Item On Kill");
		LanguageAPI.Add("ThanosGenDesc", "Guaranteed Item On Boss Kill\n <style=cIsUtility>\" + 1 + \"% (+\" + 3 + \"%)</style> Chance For An Item On Elite Kill\n <style=cIsUtility>\" + 1 + \"% (+\" + 1 + \"%)</style> Chance For An Item On Enemy Kill");
		LanguageAPI.Add("ThanosGenLore", "AI Generated Stories with Thanos at the forefront");
	}
}
internal class WoatReaction
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnLevelUp <>9__3_0;

		internal void <hooks>b__3_0(orig_OnLevelUp orig, CharacterBody self)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((self != null) ? self.inventory : null)) && self.inventory.GetItemCount(myItemDef.itemIndex) > 0)
			{
				int itemCount = self.inventory.GetItemCount(myItemDef.itemIndex);
				if (itemCount > 0)
				{
					self.baseDamage += (float)(3 * itemCount);
				}
			}
		}
	}

	public static ItemDef myItemDef;

	internal static void Init()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		CreateItem();
		AddTokens();
		ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
		ItemAPI.Add(new CustomItem(myItemDef, val));
		hooks();
	}

	private static void CreateItem()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		myItemDef = ScriptableObject.CreateInstance<ItemDef>();
		((Object)myItemDef).name = "WoatReaction";
		myItemDef.nameToken = "WoatReaction";
		myItemDef.pickupToken = "WoatReactionItem";
		myItemDef.descriptionToken = "WoatReactionDesc";
		myItemDef.loreToken = "WoatReactionDesc";
		myItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 };
		myItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion();
		Sprite pickupIconSprite = Assets.icons.LoadAsset<Sprite>("woatreaction");
		myItemDef.pickupIconSprite = pickupIconSprite;
		GameObject pickupModelPrefab = Assets.prefabs.LoadAsset<GameObject>("woatOBJ");
		myItemDef.pickupModelPrefab = pickupModelPrefab;
		myItemDef.canRemove = true;
		myItemDef.hidden = false;
	}

	private static void hooks()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		object obj = <>c.<>9__3_0;
		if (obj == null)
		{
			hook_OnLevelUp val = delegate(orig_OnLevelUp orig, CharacterBody self)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)((self != null) ? self.inventory : null)) && self.inventory.GetItemCount(myItemDef.itemIndex) > 0)
				{
					int itemCount = self.inventory.GetItemCount(myItemDef.itemIndex);
					if (itemCount > 0)
					{
						self.baseDamage += (float)(3 * itemCount);
					}
				}
			};
			<>c.<>9__3_0 = val;
			obj = (object)val;
		}
		CharacterBody.OnLevelUp += (hook_OnLevelUp)obj;
	}

	private static void AddTokens()
	{
		LanguageAPI.Add("WoatReaction", "The Woat");
		LanguageAPI.Add("WoatReactionItem", "Increase Base Damage on Level Up");
		LanguageAPI.Add("WoatReactionDesc", "Gain <style=cIsUtility>+" + 3 + "</style><style=cStack>(+" + 3 + ")</style> base damage on level up");
		LanguageAPI.Add("WoatReactionLore", "The Worst of All Time Reaciton");
	}
}