Decompiled source of RobomandoFix v1.0.0

RobomandoFix.dll

Decompiled a day ago
using System;
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.Logging;
using HDeMods.ROBOMANDO;
using HarmonyLib;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using RoR2;
using RoR2.Projectile;
using RobomandoMod.Survivors.Robomando;
using RobomandoMod.Survivors.Robomando.SkillStates;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("RobomandoMod")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RobomandoFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RobomandoFix")]
[assembly: AssemblyTitle("RobomandoFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HDeMods
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.HDeDeDe.RobomandoFix", "RobomandoFix", "1.0.0")]
	public sealed class RobomandoFixPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.HDeDeDe.RobomandoFix";

		public const string PluginAuthor = "HDeDeDe";

		public const string PluginName = "RobomandoFix";

		public const string PluginVersion = "1.0.0";

		private void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			RobomandoFix.Startup();
		}
	}
	public static class RobomandoFix
	{
		private static ILHook shootHook;

		private static ILHook zapHook;

		internal static void Startup()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			shootHook = new ILHook((MethodBase)AccessTools.Method(typeof(Shoot), "Fire", (Type[])null, (Type[])null), new Manipulator(ShootFix));
			zapHook = new ILHook((MethodBase)AccessTools.Method(typeof(Zap), "Fire", (Type[])null, (Type[])null), new Manipulator(ZapFix));
			RobomandoAssets.projectileBouncyBomb.GetComponent<ProjectileDamage>().damageType.damageSource = (DamageSource)2;
		}

		private static void ShootFix(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DamageTypeCombo>(x, "op_Implicit")
			}))
			{
				Log.Error("Failed to hook RobomandoMod.Survivors.Robomando.SkillStates.Shoot.Fire!");
				return;
			}
			val.EmitDelegate<Func<DamageTypeCombo, DamageTypeCombo>>((Func<DamageTypeCombo, DamageTypeCombo>)delegate(DamageTypeCombo damageType)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				damageType.damageSource = (DamageSource)1;
				return damageType;
			});
		}

		private static void ZapFix(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<BulletAttack>(x, "Fire")
			}))
			{
				Log.Error("Failed to hook RobomandoMod.Survivors.Robomando.SkillStates.Zap.Fire!");
				return;
			}
			val.EmitDelegate<Action<BulletAttack>>((Action<BulletAttack>)delegate(BulletAttack attack)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				attack.damageType.damageSource = (DamageSource)2;
			});
			val.Emit(OpCodes.Ldloc, 3);
		}
	}
}
namespace HDeMods.ROBOMANDO
{
	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)
		{
		}
	}
}