Decompiled source of VoidExplosionResult v0.0.0

RoR2VoidExplosionResult.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Artifacts;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("RoR2VoidExplosionResult")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for Risk of Rain 2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5f46757aafdd503a7bbfe630ec5e27f2dd1cf646")]
[assembly: AssemblyProduct("RoR2VoidExplosionResult")]
[assembly: AssemblyTitle("RoR2VoidExplosionResult")]
[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 System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
}
namespace RoR2VoidExplosionResult
{
	[BepInPlugin("com.DestroyedClone.VoidDeathResult", "Void Death Result", "0.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<bool> cfgPerformInvasion;

		public static Dictionary<string, string> transformPairs = new Dictionary<string, string> { { "CommandoBody", "VoidSurvivorBody" } };

		public const string tokenTransform = "PLAYER_DEATH_QUOTE_VOIDDEATH_TRANSFORM";

		public const string tokenExtraLife = "PLAYER_DEATH_QUOTE_VOIDDEATH_EXTRALIFE";

		public void Start()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			cfgPerformInvasion = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Perform Invasion on Transform", true, "If true, then your Commando Umbra will spawn when transformed by this mod.");
			LanguageAPI.Add("PLAYER_DEATH_QUOTE_VOIDDEATH_TRANSFORM_2P", "You have been escaped your imprisonment, but things are different.");
			LanguageAPI.Add("PLAYER_DEATH_QUOTE_VOIDDEATH_TRANSFORM", "{0} has returned as a different form.");
			LanguageAPI.Add("PLAYER_DEATH_QUOTE_VOIDDEATH_EXTRALIFE_2P", "You have escaped your imprisonment, giving up something else.");
			LanguageAPI.Add("PLAYER_DEATH_QUOTE_VOIDDEATH_EXTRALIFE", "{0} has avoided imprisonment.");
			Chat.SendBroadcastChat_ChatMessageBase += new hook_SendBroadcastChat_ChatMessageBase(Chat_SendBroadcastChat_ChatMessageBase);
		}

		private void Chat_SendBroadcastChat_ChatMessageBase(orig_SendBroadcastChat_ChatMessageBase orig, ChatMessageBase message)
		{
			//IL_009b: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			PlayerDeathChatMessage val = (PlayerDeathChatMessage)(object)((message is PlayerDeathChatMessage) ? message : null);
			if (val != null && Object.op_Implicit((Object)(object)((SubjectChatMessage)val).subjectAsNetworkUser))
			{
				bool flag = ((SubjectChatMessage)val).subjectAsNetworkUser.master.inventory.GetItemCount(Items.ExtraLife) > 0 || ((SubjectChatMessage)val).subjectAsNetworkUser.master.inventory.GetItemCount(Items.ExtraLifeVoid) > 0;
				if (((SubjectChatMessage)val).baseToken == "PLAYER_DEATH_QUOTE_VOIDDEATH")
				{
					if (flag)
					{
						((SubjectChatMessage)val).baseToken = "PLAYER_DEATH_QUOTE_VOIDDEATH_EXTRALIFE";
					}
					else if (((SubjectChatMessage)val).subjectAsNetworkUser.NetworkbodyIndexPreference == BodyCatalog.FindBodyIndex("CommandoBody"))
					{
						if (cfgPerformInvasion.Value)
						{
							int num = Mathf.FloorToInt(Run.instance.GetRunStopwatch() / 600f);
							DoppelgangerInvasionManager.CreateDoppelganger(((SubjectChatMessage)val).subjectAsNetworkUser.master, new Xoroshiro128Plus(Run.instance.seed + (ulong)num));
						}
						((SubjectChatMessage)val).subjectAsNetworkUser.master.TransformBody("VoidSurvivorBody");
						((SubjectChatMessage)val).baseToken = "PLAYER_DEATH_QUOTE_VOIDDEATH_TRANSFORM";
					}
				}
			}
			orig.Invoke(message);
		}
	}
}