Decompiled source of LaIncubadabraRevived v1.1.5

LaIncubadabraRevivedd.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using EntityStates.ParentEgg;
using HG.Reflection;
using HarmonyLib;
using On.EntityStates.ParentEgg;
using R2API.Utils;
using RiskyMod.Allies;
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: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("LaIncubadabraRevivedd")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LaIncubadabraRevivedd")]
[assembly: AssemblyTitle("LaIncubadabraRevivedd")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace LaIncubadabraRevived;

[BepInPlugin("com.phreel.LaIncubadabraRevived", "LaIncubadabraRevived", "1.1.5")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class LaIncubadabraRevived : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnHatchlingSpawned <>9__1_0;

		internal void <RiskyModCompat>b__1_0(orig_OnHatchlingSpawned orig, Hatch self, SpawnResult spawnResult)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			orig.Invoke(self, spawnResult);
			if (!Object.op_Implicit((Object)(object)spawnResult.spawnedInstance))
			{
				return;
			}
			CharacterMaster component = spawnResult.spawnedInstance.GetComponent<CharacterMaster>();
			if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)component.inventory))
			{
				CharacterBody body = component.GetBody();
				if (Object.op_Implicit((Object)(object)body) && !body.isPlayerControlled)
				{
					component.inventory.GiveItem(Items.UseAmbientLevel, 1);
					component.inventory.GiveItem(AllyItems.AllyMarkerItem, 1);
					component.inventory.GiveItem(AllyItems.AllyScalingItem, 1);
				}
			}
		}
	}

	public void Awake()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		if (Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod"))
		{
			RiskyModCompat();
		}
		new Harmony("com.phreel.LaIncubadabraRevived").PatchAll(Assembly.GetExecutingAssembly());
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	private void RiskyModCompat()
	{
		//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
		object obj = <>c.<>9__1_0;
		if (obj == null)
		{
			hook_OnHatchlingSpawned val = delegate(orig_OnHatchlingSpawned orig, Hatch self, SpawnResult spawnResult)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: 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)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Invalid comparison between Unknown and I4
				orig.Invoke(self, spawnResult);
				if (Object.op_Implicit((Object)(object)spawnResult.spawnedInstance))
				{
					CharacterMaster component = spawnResult.spawnedInstance.GetComponent<CharacterMaster>();
					if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)component.inventory))
					{
						CharacterBody body = component.GetBody();
						if (Object.op_Implicit((Object)(object)body) && !body.isPlayerControlled)
						{
							component.inventory.GiveItem(Items.UseAmbientLevel, 1);
							component.inventory.GiveItem(AllyItems.AllyMarkerItem, 1);
							component.inventory.GiveItem(AllyItems.AllyScalingItem, 1);
						}
					}
				}
			};
			<>c.<>9__1_0 = val;
			obj = (object)val;
		}
		Hatch.OnHatchlingSpawned += (hook_OnHatchlingSpawned)obj;
	}
}
[HarmonyPatch(typeof(ItemCatalog))]
internal class ItemCatalogPatch
{
	[HarmonyPrefix]
	[HarmonyPatch("SetItemDefs")]
	private static void SetItemDefs(ItemDef[] newItemDefs)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		ManualLogSource val = Logger.CreateLogSource("LaIncubadabraRevived");
		try
		{
			ItemDef val2 = newItemDefs.First((ItemDef i) => ((Object)i).name == "Incubator");
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.tags = (ItemTag[])(object)new ItemTag[3]
				{
					default(ItemTag),
					(ItemTag)4,
					(ItemTag)6
				};
				val2.deprecatedTier = (ItemTier)1;
				val.LogMessage((object)"Ancestral Incubator is now findable");
			}
			else
			{
				val.LogMessage((object)"Could not locate Ancestral Incubator item");
			}
		}
		finally
		{
			((IDisposable)val)?.Dispose();
		}
	}
}