using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("RemoveScourgeInvaders")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+97e41a7a6d947aa53a9a2ef12db9f8631f20a6ad")]
[assembly: AssemblyProduct("Remove Scourge Invaders")]
[assembly: AssemblyTitle("RemoveScourgeInvaders")]
[assembly: AssemblyVersion("1.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 RemoveScourgeInvaders
{
[BepInPlugin("RemoveScourgeInvaders", "Remove Scourge Invaders", "1.1.0")]
[BepInProcess("Magicite.exe")]
public class RemoveInvader : BaseUnityPlugin
{
public void Awake()
{
Harmony.CreateAndPatchAll(typeof(RemoveInvader), "RemoveInvader");
}
[HarmonyPatch]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> RemoveInvaderTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Expected O, but got Unknown
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
int num = 8;
int num2 = 7;
int num3 = 6;
int num4 = 13;
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
{
new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"Boss", (string)null)
}).Advance(-num);
for (int i = 0; i < num; i++)
{
List<Label> labels = val.Labels;
val.SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null)).AddLabels((IEnumerable<Label>)labels).Advance(1);
}
List<CodeInstruction> list = new List<CodeInstruction>();
List<CodeInstruction> list2 = new List<CodeInstruction>();
for (int j = 0; j < num2; j++)
{
list.Add(val.Instruction);
val.Advance(1);
}
for (int k = 0; k < num3; k++)
{
list2.Add(val.Instruction);
val.Advance(1);
}
val.Advance(-num2 - num3);
foreach (CodeInstruction item in list2)
{
val.SetInstructionAndAdvance(item);
}
foreach (CodeInstruction item2 in list)
{
val.SetInstructionAndAdvance(item2);
}
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"e/invader", (string)null)
});
for (int l = 0; l < num4; l++)
{
List<Label> labels2 = val.Labels;
val.SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null)).AddLabels((IEnumerable<Label>)labels2).Advance(1);
}
return val.Instructions();
}
private static MethodInfo TargetMethod()
{
string name = "$Invader$1516";
string name2 = "MoveNext";
return typeof(GameScript).GetNestedType(name, BindingFlags.Instance | BindingFlags.NonPublic).GetNestedType("$", BindingFlags.Instance | BindingFlags.NonPublic).GetMethod(name2, BindingFlags.Instance | BindingFlags.Public);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "RemoveScourgeInvaders";
public const string PLUGIN_NAME = "Remove Scourge Invaders";
public const string PLUGIN_VERSION = "1.1.0";
}
}