Decompiled source of VoidUnstableTransmitter v1.0.1

VoidUnstableTransmitter.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
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.Logging;
using HDeMods.VOIDUT;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("VoidUnstableTransmitter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2dc77d85d353e8d6894c895b81e7553c71558575")]
[assembly: AssemblyProduct("VoidUnstableTransmitter")]
[assembly: AssemblyTitle("VoidUnstableTransmitter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace HDeMods
{
	[BepInPlugin("HDeDeDe.VoidUnstableTransmitter", "VoidUnstableTransmitter", "1.0.1")]
	public sealed class VoidUnstableTransmitterPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "HDeDeDe.VoidUnstableTransmitter";

		public const string PluginAuthor = "HDeDeDe";

		public const string PluginName = "VoidUnstableTransmitter";

		public const string PluginVersion = "1.0.1";

		private static AssetBundle? voidIcon;

		private static Sprite? picsOrItDidntHappen;

		private void Awake()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			voidIcon = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("VoidUnstableTransmitter.dll", "voidunstabletransmitter"));
			picsOrItDidntHappen = voidIcon.LoadAsset<Sprite>("voidtrans");
			ItemCatalog.SetItemRelationships += new hook_SetItemRelationships(ItemCatalogOnSetItemRelationships);
			((ResourceAvailability)(ref ItemCatalog.availability)).onAvailable += VoidIt;
		}

		private static void ItemCatalogOnSetItemRelationships(orig_SetItemRelationships orig, ItemRelationshipProvider[] newproviders)
		{
			//IL_001c: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			ItemRelationshipProvider val = ScriptableObject.CreateInstance<ItemRelationshipProvider>();
			val.relationshipType = ItemRelationshipTypes.ContagiousItem;
			val.relationships = (Pair[])(object)new Pair[1]
			{
				new Pair
				{
					itemDef2 = Items.TeleportOnLowHealth,
					itemDef1 = Items.Phasing
				}
			};
			orig.Invoke(newproviders.Concat((IEnumerable<ItemRelationshipProvider>)(object)new ItemRelationshipProvider[1] { val }).ToArray());
		}

		private static void VoidIt()
		{
			Items.TeleportOnLowHealth.tier = (ItemTier)7;
			Items.TeleportOnLowHealth.pickupIconSprite = picsOrItDidntHappen;
		}
	}
}
namespace HDeMods.VOIDUT
{
	internal static class Log
	{
		private static ManualLogSource? logMe;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			logMe.LogWarning(data);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}