Decompiled source of MysteryEggs v1.0.1

plugins/MysteryEggs.dll

Decompiled 6 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MysteryEggs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+453a89b297f466fd589506e743ea7b4ca4a8b936")]
[assembly: AssemblyProduct("MysteryEggs")]
[assembly: AssemblyTitle("MysteryEggs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MysteryEggs
{
	public static class Asset
	{
		public static AssetBundle mainBundle;

		public const string bundleName = "mysteryeggsbundle";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(typeof(MysteryEggsPlugin).Assembly.Location), "mysteryeggsbundle".ToLower());

		public static void Init()
		{
			mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	internal class GoldEggBehavior : ItemBehavior
	{
		private float timeBetweenResummons = 30f;

		private float timeBetweenRetryResummons = 1f;

		private float resummonCooldown;

		private DeployableSlot slot = MysteryEggsPlugin.goldSlot;

		public static ItemDef GetItemDef()
		{
			return MysteryEggsPlugin.goldEgg;
		}

		private void Awake()
		{
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			resummonCooldown = timeBetweenRetryResummons;
		}

		private void FixedUpdate()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			int stack = base.stack;
			CharacterMaster bodyMaster = base.body.master;
			if (!Object.op_Implicit((Object)(object)bodyMaster))
			{
				return;
			}
			int deployableCount = bodyMaster.GetDeployableCount(slot);
			if (deployableCount < stack)
			{
				resummonCooldown -= Time.fixedDeltaTime;
				if (resummonCooldown <= 0f)
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BeetleGuard/BeetleGuardMaster.prefab").WaitForCompletion(), "lunarboi");
					GameObject val2 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BeetleGuard/BeetleGuardBody.prefab").WaitForCompletion(), "lunarboibody");
					CharacterBody component = val2.GetComponent<CharacterBody>();
					component.baseRegen = 0.6f;
					component.levelRegen = 0.12f;
					component.baseMaxHealth = 800f;
					component.baseDamage = 20f;
					val.GetComponent<CharacterMaster>().bodyPrefab = val2;
					CharacterSpawnCard val3 = ScriptableObject.CreateInstance<CharacterSpawnCard>();
					((SpawnCard)val3).prefab = val;
					val3.itemsToGrant = (ItemCountPair[])(object)new ItemCountPair[1]
					{
						new ItemCountPair
						{
							itemDef = MysteryEggsPlugin.goldOnKill,
							count = 1
						}
					};
					DirectorSpawnRequest val4 = new DirectorSpawnRequest((SpawnCard)(object)val3, new DirectorPlacementRule
					{
						placementMode = (PlacementMode)1,
						minDistance = 3f,
						maxDistance = 40f,
						spawnOnTarget = ((Component)this).transform
					}, RoR2Application.rng);
					val4.summonerBodyObject = ((Component)this).gameObject;
					val4.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val4.onSpawnedServer, new Action<SpawnResult>(OnSpawned));
					DirectorCore.instance.TrySpawnObject(val4);
					resummonCooldown = timeBetweenResummons / (float)stack;
				}
			}
			void OnSpawned(SpawnResult result)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				if (result.success)
				{
					bodyMaster.AddDeployable(result.spawnedInstance.GetComponent<Deployable>(), slot);
				}
				else
				{
					resummonCooldown = timeBetweenRetryResummons;
				}
			}
		}
	}
	internal static class Language
	{
		public static string TokensOutput = "";

		public static bool usingLanguageFolder = false;

		public static bool printingEnabled = false;

		public static void Init()
		{
			if (usingLanguageFolder)
			{
				Language.collectLanguageRootFolders += Language_collectLanguageRootFolders;
			}
		}

		private static void Language_collectLanguageRootFolders(List<string> obj)
		{
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)MysteryEggsPlugin.instance).Info.Location), "Language");
			if (Directory.Exists(text))
			{
				obj.Add(text);
			}
		}

		public static void Add(string token, string text)
		{
			if (!usingLanguageFolder)
			{
				LanguageAPI.Add(token, text);
			}
			if (printingEnabled)
			{
				TokensOutput = TokensOutput + "\n    \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\",";
			}
		}

		public static void PrintOutput(string fileName = "")
		{
			if (printingEnabled)
			{
				string text = "{\n    strings:\n    {" + TokensOutput + "\n    }\n}";
				Log.Message(fileName + ": \n" + text);
				if (!string.IsNullOrEmpty(fileName))
				{
					string path = Path.Combine(Directory.GetParent(((BaseUnityPlugin)MysteryEggsPlugin.instance).Info.Location).FullName, "Language", "en", fileName);
					File.WriteAllText(path, text);
				}
				TokensOutput = "";
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	internal class LunarEggBehavior : ItemBehavior
	{
		private float timeBetweenResummons = 10f;

		private float timeBetweenRetryResummons = 1f;

		private float resummonCooldown;

		private DeployableSlot slot = MysteryEggsPlugin.lunarSlot;

		public static ItemDef GetItemDef()
		{
			return MysteryEggsPlugin.lunarEgg;
		}

		private void Awake()
		{
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			resummonCooldown = timeBetweenRetryResummons;
		}

		private void FixedUpdate()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_00bd: 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)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Expected O, but got Unknown
			int stack = base.stack;
			CharacterMaster bodyMaster = base.body.master;
			if (!Object.op_Implicit((Object)(object)bodyMaster))
			{
				return;
			}
			int deployableCount = bodyMaster.GetDeployableCount(slot);
			if (deployableCount >= stack)
			{
				return;
			}
			resummonCooldown -= Time.fixedDeltaTime;
			if (!(resummonCooldown <= 0f))
			{
				return;
			}
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianMaster.prefab").WaitForCompletion(), "lunarboi");
			val.AddComponent<Deployable>();
			AISkillDriver val2 = val.AddComponent<AISkillDriver>();
			val2.moveTargetType = (TargetType)2;
			val2.movementType = (MovementType)1;
			val2.aimType = (AimType)1;
			val2.minDistance = 10f;
			val2.skillSlot = (SkillSlot)(-1);
			val2.customName = "ReturnToLeaderDefault";
			foreach (AISkillDriver item in val.transform)
			{
				AISkillDriver val3 = item;
				if (val3.customName.Contains("PathFromAfar"))
				{
					Object.Destroy((Object)(object)val3);
				}
			}
			GameObject val4 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianBody.prefab").WaitForCompletion(), "lunarboibody");
			CharacterBody component = val4.GetComponent<CharacterBody>();
			component.baseRegen = 0.6f;
			component.baseMaxHealth = 500f;
			val.GetComponent<CharacterMaster>().bodyPrefab = val4;
			CharacterSpawnCard val5 = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			((SpawnCard)val5).prefab = val;
			val5.itemsToGrant = (ItemCountPair[])(object)new ItemCountPair[1]
			{
				new ItemCountPair
				{
					itemDef = MysteryEggsPlugin.lunarOnKill,
					count = 1
				}
			};
			DirectorSpawnRequest val6 = new DirectorSpawnRequest((SpawnCard)(object)val5, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)1,
				minDistance = 3f,
				maxDistance = 40f,
				spawnOnTarget = ((Component)this).transform
			}, RoR2Application.rng);
			val6.summonerBodyObject = ((Component)this).gameObject;
			val6.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val6.onSpawnedServer, new Action<SpawnResult>(OnSpawned));
			DirectorCore.instance.TrySpawnObject(val6);
			resummonCooldown = timeBetweenResummons / (float)stack;
			void OnSpawned(SpawnResult result)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				if (result.success)
				{
					bodyMaster.AddDeployable(result.spawnedInstance.GetComponent<Deployable>(), slot);
				}
				else
				{
					resummonCooldown = timeBetweenRetryResummons;
				}
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Slendykray.MysteryEggs", "MysteryEggs", "1.0.0")]
	public class MysteryEggsPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static GetDeployableSameSlotLimit <>9__16_0;

			public static GetDeployableSameSlotLimit <>9__16_1;

			public static GetDeployableSameSlotLimit <>9__16_2;

			internal int <InitDeployableSlots>b__16_0(CharacterMaster master, int slot)
			{
				return master.inventory.GetItemCount(goldEgg);
			}

			internal int <InitDeployableSlots>b__16_1(CharacterMaster master, int slot)
			{
				return master.inventory.GetItemCount(lunarEgg);
			}

			internal int <InitDeployableSlots>b__16_2(CharacterMaster master, int slot)
			{
				return master.inventory.GetItemCount(voidEgg);
			}
		}

		public const string PluginGUID = "Slendykray.MysteryEggs";

		public const string PluginAuthor = "Slendykray";

		public const string PluginName = "MysteryEggs";

		public const string PluginVersion = "1.0.0";

		public static MysteryEggsPlugin instance;

		public static ItemDef lunarOnKill;

		public static ItemDef goldOnKill;

		public static ItemDef voidOnKill;

		public static ItemDef goldEgg;

		public static ItemDef lunarEgg;

		public static ItemDef voidEgg;

		public static DeployableSlot goldSlot;

		public static DeployableSlot lunarSlot;

		public static DeployableSlot voidSlot;

		public void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Asset.Init();
			InitItems();
			InitHelpers();
			InitDeployableSlots();
			Tokens.Init();
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged);
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
		}

		private void InitItems()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0068: 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_0099: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0182: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Expected O, but got Unknown
			//IL_038e: 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_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			goldEgg = ScriptableObject.CreateInstance<ItemDef>();
			((Object)goldEgg).name = "GOLDEGG_NAME";
			goldEgg.nameToken = "GOLDEGG_NAME";
			goldEgg.pickupToken = "GOLDEGG_PICKUP";
			goldEgg.descriptionToken = "GOLDEGG_DESC";
			goldEgg.loreToken = "GOLDEGG_LORE";
			goldEgg._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion();
			goldEgg.pickupIconSprite = Asset.mainBundle.LoadAsset<Sprite>("texGold");
			GameObject val2 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/FireBallDash/PickupEgg.prefab").WaitForCompletion(), "eggg");
			((Renderer)((Component)val2.transform.Find("mdlEgg")).GetComponent<MeshRenderer>()).material = Asset.mainBundle.LoadAsset<Material>("matGold");
			goldEgg.pickupModelPrefab = val2;
			goldEgg.canRemove = true;
			goldEgg.hidden = false;
			goldEgg.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)4 };
			ItemAPI.Add(new CustomItem(goldEgg, val));
			lunarEgg = ScriptableObject.CreateInstance<ItemDef>();
			((Object)lunarEgg).name = "LUNAREGG_NAME";
			lunarEgg.nameToken = "LUNAREGG_NAME";
			lunarEgg.pickupToken = "LUNAREGG_PICKUP";
			lunarEgg.descriptionToken = "LUNAREGG_DESC";
			lunarEgg.loreToken = "LUNAREGG_LORE";
			lunarEgg._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/LunarTierDef.asset").WaitForCompletion();
			lunarEgg.pickupIconSprite = Asset.mainBundle.LoadAsset<Sprite>("texLunar");
			GameObject val3 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/FireBallDash/PickupEgg.prefab").WaitForCompletion(), "eggg");
			((Renderer)((Component)val3.transform.Find("mdlEgg")).GetComponent<MeshRenderer>()).material = Asset.mainBundle.LoadAsset<Material>("matLunar");
			lunarEgg.pickupModelPrefab = val3;
			lunarEgg.canRemove = true;
			lunarEgg.hidden = false;
			lunarEgg.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)4 };
			ItemAPI.Add(new CustomItem(lunarEgg, val));
			voidEgg = ScriptableObject.CreateInstance<ItemDef>();
			((Object)voidEgg).name = "VOIDEGG_NAME";
			voidEgg.nameToken = "VOIDEGG_NAME";
			voidEgg.pickupToken = "VOIDEGG_PICKUP";
			voidEgg.descriptionToken = "VOIDEGG_DESC";
			voidEgg.loreToken = "VOIDEGG_LORE";
			voidEgg._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/DLC1/Common/VoidTier2Def.asset").WaitForCompletion();
			voidEgg.pickupIconSprite = Asset.mainBundle.LoadAsset<Sprite>("texVoid");
			GameObject val4 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/FireBallDash/PickupEgg.prefab").WaitForCompletion(), "eggg");
			((Renderer)((Component)val4.transform.Find("mdlEgg")).GetComponent<MeshRenderer>()).material = Asset.mainBundle.LoadAsset<Material>("matVoid");
			voidEgg.pickupModelPrefab = val4;
			voidEgg.canRemove = true;
			voidEgg.hidden = false;
			voidEgg.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)4 };
			voidEgg.requiredExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
			ItemAPI.Add(new CustomItem(voidEgg, val));
			ItemRelationshipProvider val5 = ScriptableObject.CreateInstance<ItemRelationshipProvider>();
			((Object)val5).name = "MysteryEggContagiousItemProvider";
			val5.relationshipType = Addressables.LoadAssetAsync<ItemRelationshipType>((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion();
			val5.relationships = (Pair[])(object)new Pair[1]
			{
				new Pair
				{
					itemDef1 = goldEgg,
					itemDef2 = voidEgg
				}
			};
			ContentAddition.AddItemRelationshipProvider(val5);
		}

		private void InitDeployableSlots()
		{
			//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_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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			object obj = <>c.<>9__16_0;
			if (obj == null)
			{
				GetDeployableSameSlotLimit val = (CharacterMaster master, int slot) => master.inventory.GetItemCount(goldEgg);
				<>c.<>9__16_0 = val;
				obj = (object)val;
			}
			goldSlot = DeployableAPI.RegisterDeployableSlot((GetDeployableSameSlotLimit)obj);
			object obj2 = <>c.<>9__16_1;
			if (obj2 == null)
			{
				GetDeployableSameSlotLimit val2 = (CharacterMaster master, int slot) => master.inventory.GetItemCount(lunarEgg);
				<>c.<>9__16_1 = val2;
				obj2 = (object)val2;
			}
			lunarSlot = DeployableAPI.RegisterDeployableSlot((GetDeployableSameSlotLimit)obj2);
			object obj3 = <>c.<>9__16_2;
			if (obj3 == null)
			{
				GetDeployableSameSlotLimit val3 = (CharacterMaster master, int slot) => master.inventory.GetItemCount(voidEgg);
				<>c.<>9__16_2 = val3;
				obj3 = (object)val3;
			}
			voidSlot = DeployableAPI.RegisterDeployableSlot((GetDeployableSameSlotLimit)obj3);
		}

		private void InitHelpers()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0068: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Expected O, but got Unknown
			ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			goldOnKill = ScriptableObject.CreateInstance<ItemDef>();
			((Object)goldOnKill).name = "GOLDONKILL_NAME";
			goldOnKill.nameToken = "GOLDONKILL_NAME";
			goldOnKill.pickupToken = "GOLDONKILL_PICKUP";
			goldOnKill.descriptionToken = "GOLDONKILL_DESC";
			goldOnKill.loreToken = "GOLDONKILL_LORE";
			goldOnKill.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Core/texNullIcon.png").WaitForCompletion();
			goldOnKill.canRemove = false;
			goldOnKill.hidden = true;
			goldOnKill.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)9 };
			goldOnKill.deprecatedTier = (ItemTier)5;
			ItemAPI.Add(new CustomItem(goldOnKill, val));
			lunarOnKill = ScriptableObject.CreateInstance<ItemDef>();
			((Object)lunarOnKill).name = "LUNARONKILL_NAME";
			lunarOnKill.nameToken = "LUNARONKILL_NAME";
			lunarOnKill.pickupToken = "LUNARONKILL_PICKUP";
			lunarOnKill.descriptionToken = "LUNARONKILL_DESC";
			lunarOnKill.loreToken = "LUNARONKILL_LORE";
			lunarOnKill.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Core/texNullIcon.png").WaitForCompletion();
			lunarOnKill.canRemove = false;
			lunarOnKill.hidden = true;
			lunarOnKill.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)9 };
			lunarOnKill.deprecatedTier = (ItemTier)5;
			ItemAPI.Add(new CustomItem(lunarOnKill, val));
			voidOnKill = ScriptableObject.CreateInstance<ItemDef>();
			((Object)voidOnKill).name = "VOIDONKILL_NAME";
			voidOnKill.nameToken = "VOIDONKILL_NAME";
			voidOnKill.pickupToken = "VOIDONKILL_PICKUP";
			voidOnKill.descriptionToken = "VOIDONKILL_DESC";
			voidOnKill.loreToken = "VOIDONKILL_LORE";
			voidOnKill.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Core/texNullIcon.png").WaitForCompletion();
			voidOnKill.canRemove = false;
			voidOnKill.hidden = true;
			voidOnKill.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)9 };
			voidOnKill.deprecatedTier = (ItemTier)5;
			ItemAPI.Add(new CustomItem(voidOnKill, val));
		}

		private void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
		{
			if (NetworkServer.active)
			{
				self.AddItemBehavior<LunarEggBehavior>(self.inventory.GetItemCount(lunarEgg));
				self.AddItemBehavior<GoldEggBehavior>(self.inventory.GetItemCount(goldEgg));
				self.AddItemBehavior<VoidEggBehavior>(self.inventory.GetItemCount(voidEgg));
			}
			orig.Invoke(self);
		}

		private void GlobalEventManager_onCharacterDeathGlobal(DamageReport report)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)report.attacker) || !Object.op_Implicit((Object)(object)report.attackerBody))
			{
				return;
			}
			TeamIndex attackerTeamIndex = report.attackerTeamIndex;
			CharacterBody attackerBody = report.attackerBody;
			if (!Object.op_Implicit((Object)(object)attackerBody.inventory))
			{
				return;
			}
			int itemCount = attackerBody.inventory.GetItemCount(goldOnKill.itemIndex);
			if (itemCount > 0)
			{
				GameObject val = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/BonusMoneyPack"), ((Component)report.victim).gameObject.transform.position, Random.rotation);
				TeamFilter component = val.GetComponent<TeamFilter>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.teamIndex = attackerTeamIndex;
				}
				NetworkServer.Spawn(val);
			}
			int itemCount2 = attackerBody.inventory.GetItemCount(lunarOnKill.itemIndex);
			if (itemCount2 > 0)
			{
				PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex), ((Component)report.victim).transform.position, Vector3.up * 10f);
			}
			int itemCount3 = attackerBody.inventory.GetItemCount(voidOnKill.itemIndex);
			if (itemCount3 > 0)
			{
				if (Chainloader.PluginInfos.ContainsKey("bubbet.bubbetsitems"))
				{
					PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(MiscPickups.VoidCoin.miscPickupIndex), ((Component)report.victim).transform.position, Vector3.up * 10f);
				}
				else
				{
					PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex), ((Component)report.victim).transform.position, Vector3.up * 10f);
				}
			}
		}

		private void Update()
		{
		}
	}
	internal class Tokens
	{
		public static void Init()
		{
			Language.Add("GOLDEGG_NAME", "Golden Beetle Egg");
			Language.Add("GOLDEGG_PICKUP", "Recruit a " + UtilityText("Beetle Guard") + ". Drops " + DamageText("Gold") + " on kill.");
			Language.Add("GOLDEGG_DESC", "Every " + UtilityText("30") + " " + StackText("-50%") + " seconds summon a " + UtilityText("Beetle Guard") + ". Drops " + DamageText("Gold chunks") + " on kill. Can have up to " + UtilityText("1") + " " + StackText("+1") + ".");
			Language.Add("GOLDEGG_LORE", "goldddddddd");
			Language.Add("LUNAREGG_NAME", "Newt's Egg");
			Language.Add("LUNAREGG_PICKUP", "Recruit a " + UtilityText("Lemurian") + ". Drops " + UtilityText("Lunar coins") + " on kill.");
			Language.Add("LUNAREGG_DESC", "Every " + UtilityText("10") + " " + StackText("-50%") + " seconds summon a " + UtilityText("Lemurian") + ". Drops " + UtilityText("Lunar coins") + " on kill. Can have up to " + UtilityText("1") + " " + StackText("+1") + ".");
			Language.Add("LUNAREGG_LORE", "lunarrrrrr");
			string text = UtilityText("Lunar coins");
			if (Chainloader.PluginInfos.ContainsKey("bubbet.bubbetsitems"))
			{
				text = VoidText("Void markers");
			}
			Language.Add("VOIDEGG_NAME", "V01? 366");
			Language.Add("VOIDEGG_PICKUP", "Recruit a " + VoidText("Void ally") + ". Drops " + text + " on kill. " + VoidText("Corrupts all Golden Beetle Eggs") + ".");
			Language.Add("VOIDEGG_DESC", "Every " + UtilityText("60") + " " + StackText("-50%") + " seconds summon a " + VoidText("Void ally") + ". Drops " + text + " on kill. Can have up to " + UtilityText("1") + " " + StackText("+1") + ". " + VoidText("Corrupts all Golden Beetle Eggs") + ".");
			Language.Add("VOIDEGG_LORE", "voiddddd");
		}

		public static string UtilityText(string text)
		{
			return "<style=cIsUtility>" + text + "</style>";
		}

		public static string StackText(string text)
		{
			return "<style=cStack>(" + text + " per stack)</style>";
		}

		public static string DamageText(string text)
		{
			return "<style=cIsDamage>" + text + "</style>";
		}

		public static string VoidText(string text)
		{
			return "<style=cIsVoid>" + text + "</style>";
		}
	}
	internal class VoidEggBehavior : ItemBehavior
	{
		private float timeBetweenResummons = 60f;

		private float timeBetweenRetryResummons = 1f;

		private float resummonCooldown;

		private DeployableSlot slot = MysteryEggsPlugin.voidSlot;

		public static ItemDef GetItemDef()
		{
			return MysteryEggsPlugin.voidEgg;
		}

		private void Awake()
		{
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			resummonCooldown = timeBetweenRetryResummons;
		}

		private void FixedUpdate()
		{
			//IL_0045: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: 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_01fd: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Expected O, but got Unknown
			int stack = base.stack;
			CharacterMaster bodyMaster = base.body.master;
			if (!Object.op_Implicit((Object)(object)bodyMaster))
			{
				return;
			}
			int deployableCount = bodyMaster.GetDeployableCount(slot);
			if (deployableCount < stack)
			{
				resummonCooldown -= Time.fixedDeltaTime;
				if (resummonCooldown <= 0f)
				{
					int num = Random.Range(0, 3);
					GameObject[] array = (GameObject[])(object)new GameObject[3]
					{
						Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Nullifier/NullifierMaster.prefab").WaitForCompletion(),
						Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidJailer/VoidJailerMaster.prefab").WaitForCompletion(),
						Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidMegaCrab/VoidMegaCrabMaster.prefab").WaitForCompletion()
					};
					GameObject[] array2 = (GameObject[])(object)new GameObject[3]
					{
						Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Nullifier/NullifierBody.prefab").WaitForCompletion(),
						Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidJailer/VoidJailerBody.prefab").WaitForCompletion(),
						Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidMegaCrab/VoidMegaCrabBody.prefab").WaitForCompletion()
					};
					GameObject val = PrefabAPI.InstantiateClone(array[num], "lunarboi");
					val.AddComponent<Deployable>();
					AISkillDriver val2 = val.AddComponent<AISkillDriver>();
					val2.moveTargetType = (TargetType)2;
					val2.movementType = (MovementType)1;
					val2.aimType = (AimType)1;
					val2.minDistance = 10f;
					val2.skillSlot = (SkillSlot)(-1);
					val2.customName = "ReturnToLeaderDefault";
					CharacterSpawnCard val3 = ScriptableObject.CreateInstance<CharacterSpawnCard>();
					((SpawnCard)val3).prefab = val;
					val3.itemsToGrant = (ItemCountPair[])(object)new ItemCountPair[1]
					{
						new ItemCountPair
						{
							itemDef = MysteryEggsPlugin.voidOnKill,
							count = 1
						}
					};
					DirectorSpawnRequest val4 = new DirectorSpawnRequest((SpawnCard)(object)val3, new DirectorPlacementRule
					{
						placementMode = (PlacementMode)1,
						minDistance = 3f,
						maxDistance = 40f,
						spawnOnTarget = ((Component)this).transform
					}, RoR2Application.rng);
					val4.summonerBodyObject = ((Component)this).gameObject;
					val4.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val4.onSpawnedServer, new Action<SpawnResult>(OnSpawned));
					DirectorCore.instance.TrySpawnObject(val4);
					resummonCooldown = timeBetweenResummons / (float)stack;
				}
			}
			void OnSpawned(SpawnResult result)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				if (result.success)
				{
					bodyMaster.AddDeployable(result.spawnedInstance.GetComponent<Deployable>(), slot);
				}
				else
				{
					resummonCooldown = timeBetweenRetryResummons;
				}
			}
		}
	}
}