using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
using volatileEmployees.NetcodePatcher;
using volatileEmployees.Patches;
using volatileEmployees.Patches.Enemies;
using volatileEmployees.Patches.Player;
[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("volatileEmployees")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("[]")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("volatileEmployees")]
[assembly: AssemblyTitle("volatileEmployees")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
namespace volatileEmployees
{
internal class Config
{
public ConfigEntry<bool> playerImmunity;
public ConfigEntry<bool> patchGiantKiwi;
public Config(ConfigFile cfg)
{
playerImmunity = cfg.Bind<bool>("Explosion Immunity", "Is the player immune to explosion damage and death?", true, (ConfigDescription)null);
patchGiantKiwi = cfg.Bind<bool>("Sapsucker explodes", "Will Giant Sapsuckers explode like normal enemies? (Slightly bugged)", false, (ConfigDescription)null);
Plugin.mls.LogDebug((object)"Configs created!");
}
}
internal static class ILExtensions
{
internal static void Add(this List<CodeInstruction> instructions, OpCode op, object operand = null)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
instructions.Add(new CodeInstruction(op, operand));
}
internal static void PrintCodeList(this List<CodeInstruction> codes)
{
Plugin.mls.LogDebug((object)"\n\nNew codes:\n");
foreach (CodeInstruction code in codes)
{
Plugin.mls.LogDebug((object)code);
}
}
}
[BepInPlugin("cookiecaker.volatileEmployees", "Volatile_Employees", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
public const string modGUID = "cookiecaker.volatileEmployees";
public const string modName = "Volatile_Employees";
public const string modVersion = "0.1.0";
private static Harmony _harmony = new Harmony("cookiecaker.volatileEmployees");
internal static ManualLogSource mls = Logger.CreateLogSource("cookiecaker.volatileEmployees");
internal static Config Config;
private void Awake()
{
Config = new Config(((BaseUnityPlugin)this).Config);
NetcodePatcher();
_harmony.PatchAll(typeof(NetworkPatch));
mls.LogInfo((object)"Network patch successful!");
_harmony.PatchAll(typeof(PlayerControllerBPatch));
if (Config.playerImmunity.Value)
{
_harmony.PatchAll(typeof(DamagePlayerPatch));
_harmony.PatchAll(typeof(KillPlayerPatch));
mls.LogInfo((object)"Player patches successful!");
}
else
{
mls.LogInfo((object)"Player is not immune to explosions. Good luck!");
}
_harmony.PatchAll(typeof(BaboonBirdAIPatch));
_harmony.PatchAll(typeof(BlobAIPatch));
_harmony.PatchAll(typeof(BushWolfEnemyPatch));
_harmony.PatchAll(typeof(ButlerBeesEnemyAIPatch));
_harmony.PatchAll(typeof(ButlerEnemyAIPatch));
_harmony.PatchAll(typeof(CaveDwellerAIPatch));
_harmony.PatchAll(typeof(CentipedeAIPatch));
_harmony.PatchAll(typeof(ClaySurgeonAIPatch));
_harmony.PatchAll(typeof(CrawlerAIPatch));
bool flag = true;
_harmony.PatchAll(typeof(GiantKiwiAIPatch));
_harmony.PatchAll(typeof(HoarderBugAIPatch));
_harmony.PatchAll(typeof(JesterAIPatch));
_harmony.PatchAll(typeof(MouthDogAIPatch));
_harmony.PatchAll(typeof(NutcrackerEnemyAIPatch));
_harmony.PatchAll(typeof(PufferAIPatch));
_harmony.PatchAll(typeof(RadMechAIPatchA));
_harmony.PatchAll(typeof(RadMechAIPatchB));
_harmony.PatchAll(typeof(RedLocustBeesPatch));
_harmony.PatchAll(typeof(SandSpiderAIPatch));
_harmony.PatchAll(typeof(SpringManAIPatch));
mls.LogInfo((object)"Enemy patches successful!");
}
private void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
internal class VENetworker : NetworkBehaviour
{
internal static GameObject prefab;
internal static VENetworker Instance { get; private set; }
internal static void Init()
{
//IL_002d: 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_0040: Expected O, but got Unknown
if ((Object)(object)prefab != (Object)null)
{
Plugin.mls.LogDebug((object)"Network handler already initialized!");
return;
}
try
{
prefab = new GameObject("VENetworker")
{
hideFlags = (HideFlags)61
};
NetworkObject val = prefab.AddComponent<NetworkObject>();
byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(typeof(VENetworker).Assembly.GetName().Name + ((Object)prefab).name));
val.GlobalObjectIdHash = BitConverter.ToUInt32(value, 0);
prefab.AddComponent<VENetworker>();
NetworkManager.Singleton.AddNetworkPrefab(prefab);
Plugin.mls.LogDebug((object)"Successfully created VENetworker!");
}
catch (Exception arg)
{
Plugin.mls.LogError((object)string.Format("Something went wrong!\n{0}\n{1} will not work!", arg, "Volatile_Employees"));
}
}
internal static void Create()
{
try
{
if (NetworkManager.Singleton.IsServer && (Object)(object)prefab != (Object)null)
{
Object.Instantiate<GameObject>(prefab).GetComponent<NetworkObject>().Spawn(true);
}
}
catch (Exception arg)
{
Plugin.mls.LogError((object)string.Format("Something went wrong!\n{0}\n{1} will not work!", arg, "Volatile_Employees"));
}
}
private void Awake()
{
Instance = this;
}
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
if ((Object)(object)Instance != (Object)(object)this)
{
NetworkObject val = default(NetworkObject);
if (((Component)Instance).TryGetComponent<NetworkObject>(ref val) && !val.IsSpawned && (Object)(object)Instance != (Object)(object)prefab)
{
Object.Destroy((Object)(object)Instance);
}
Plugin.mls.LogWarning((object)"2 VENetworker objects exist! Reassigning to correct instance.");
Instance = this;
}
Plugin.mls.LogDebug((object)"Successfully spawned network object!");
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnExplosionPlayerRpc(NetworkObjectReference player)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = default(RpcAttributeParams);
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3400451470u, val2, val, (SendTo)6, (RpcDelivery)0);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendRpc(ref val3, 3400451470u, val2, val, (SendTo)6, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val4 = default(NetworkObject);
if (((NetworkObjectReference)(ref player)).TryGet(ref val4, (NetworkManager)null))
{
Plugin.mls.LogDebug((object)$"Player: {val4}");
Landmine.SpawnExplosion(((Component)((Component)val4).GetComponent<PlayerControllerB>()).transform.position, true, 5.7f, 6f, 50, 2f, (GameObject)null, false);
}
}
}
public static void SpawnExplosionEnemy(NetworkObject enemy)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
Instance.SpawnExplosionEnemyRpc(NetworkObjectReference.op_Implicit(enemy));
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnExplosionEnemyRpc(NetworkObjectReference enemy)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = default(RpcAttributeParams);
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2124151469u, val2, val, (SendTo)6, (RpcDelivery)0);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref enemy, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendRpc(ref val3, 2124151469u, val2, val, (SendTo)6, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val4 = default(NetworkObject);
if (((NetworkObjectReference)(ref enemy)).TryGet(ref val4, (NetworkManager)null))
{
Plugin.mls.LogDebug((object)$"Enemy: {val4}");
Landmine.SpawnExplosion(((Component)((Component)val4).GetComponent<EnemyAI>()).transform.position, true, 5.7f, 6f, 50, 2f, (GameObject)null, false);
}
else
{
Plugin.mls.LogDebug((object)"No netObj found!");
}
}
}
public static void SpawnExplosion5x(NetworkObject enemy)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
Instance.SpawnExplosion5xRpc(NetworkObjectReference.op_Implicit(enemy));
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnExplosion5xRpc(NetworkObjectReference enemy)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = default(RpcAttributeParams);
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(258037931u, val2, val, (SendTo)6, (RpcDelivery)0);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref enemy, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendRpc(ref val3, 258037931u, val2, val, (SendTo)6, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val4 = default(NetworkObject);
if (((NetworkObjectReference)(ref enemy)).TryGet(ref val4, (NetworkManager)null))
{
Plugin.mls.LogDebug((object)$"Enemy: {val4}");
Vector3 position = ((Component)((Component)val4).GetComponent<EnemyAI>()).transform.position;
Landmine.SpawnExplosion(position, true, 5.7f, 6f, 50, 2f, (GameObject)null, false);
Landmine.SpawnExplosion(position, true, 5.7f, 6f, 50, 2f, (GameObject)null, false);
Landmine.SpawnExplosion(position, true, 5.7f, 6f, 50, 2f, (GameObject)null, false);
Landmine.SpawnExplosion(position, true, 5.7f, 6f, 50, 2f, (GameObject)null, false);
Landmine.SpawnExplosion(position, true, 5.7f, 6f, 50, 2f, (GameObject)null, false);
}
else
{
Plugin.mls.LogDebug((object)"No netObj found!");
}
}
}
public static void DespawnEnemy(NetworkObject enemy)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
Instance.DespawnEnemyRpc(NetworkObjectReference.op_Implicit(enemy));
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void DespawnEnemyRpc(NetworkObjectReference enemy)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = default(RpcAttributeParams);
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3429199271u, val2, val, (SendTo)0, (RpcDelivery)0);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref enemy, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendRpc(ref val3, 3429199271u, val2, val, (SendTo)0, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val4 = default(NetworkObject);
if (((NetworkObjectReference)(ref enemy)).TryGet(ref val4, (NetworkManager)null))
{
Plugin.mls.LogDebug((object)$"Enemy: {val4}");
val4.Despawn(true);
}
else
{
Plugin.mls.LogDebug((object)"No netObj found!");
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3400451470u, new RpcReceiveHandler(__rpc_handler_3400451470), "SpawnExplosionPlayerRpc");
((NetworkBehaviour)this).__registerRpc(2124151469u, new RpcReceiveHandler(__rpc_handler_2124151469), "SpawnExplosionEnemyRpc");
((NetworkBehaviour)this).__registerRpc(258037931u, new RpcReceiveHandler(__rpc_handler_258037931), "SpawnExplosion5xRpc");
((NetworkBehaviour)this).__registerRpc(3429199271u, new RpcReceiveHandler(__rpc_handler_3429199271), "DespawnEnemyRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_3400451470(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference player = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((VENetworker)(object)target).SpawnExplosionPlayerRpc(player);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2124151469(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference enemy = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemy, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((VENetworker)(object)target).SpawnExplosionEnemyRpc(enemy);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_258037931(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference enemy = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemy, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((VENetworker)(object)target).SpawnExplosion5xRpc(enemy);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3429199271(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference enemy = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemy, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((VENetworker)(object)target).DespawnEnemyRpc(enemy);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "VENetworker";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "volatileEmployees";
public const string PLUGIN_NAME = "volatileEmployees";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace volatileEmployees.Patches
{
internal class NetworkPatch
{
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
private static void StartOfRound_Post_Awake()
{
VENetworker.Create();
}
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
[HarmonyPostfix]
public static void GameNetworkManager_Post_Start()
{
VENetworker.Init();
Plugin.mls.LogDebug((object)"Initialized VENetworker object!");
}
}
}
namespace volatileEmployees.Patches.Player
{
internal class DamagePlayerPatch
{
private static string name = "PlayerControllerB.DamagePlayer";
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch("DamagePlayer")]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
List<CodeInstruction> list2 = new List<CodeInstruction>();
Label label = il.DefineLabel();
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode.Equals(OpCodes.Ldarg_0))
{
list[i].labels.Add(label);
break;
}
}
list2.Add(OpCodes.Ldarg_S, 4);
ILExtensions.Add(list2, OpCodes.Ldc_I4_3);
ILExtensions.Add(list2, OpCodes.Ceq);
list2.Add(OpCodes.Brfalse_S, label);
ILExtensions.Add(list2, OpCodes.Ret);
list2.AddRange(list);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
internal class KillPlayerPatch
{
private static string name = "PlayerControllerB.KillPlayer";
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch("KillPlayer")]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
List<CodeInstruction> list2 = new List<CodeInstruction>();
Label label = il.DefineLabel();
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode.Equals(OpCodes.Ldarg_0))
{
list[i].labels.Add(label);
break;
}
}
list2.Add(OpCodes.Ldarg_S, 3);
ILExtensions.Add(list2, OpCodes.Ldc_I4_3);
ILExtensions.Add(list2, OpCodes.Ceq);
list2.Add(OpCodes.Brfalse_S, label);
ILExtensions.Add(list2, OpCodes.Ret);
list2.AddRange(list);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
[HarmonyPostfix]
private static void KillPlayerPatch(PlayerControllerB __instance, CauseOfDeath causeOfDeath)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)__instance).IsOwner && __instance.AllowPlayerDeath() && (int)causeOfDeath != 3)
{
VENetworker.Instance.SpawnExplosionPlayerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject));
}
}
}
}
namespace volatileEmployees.Patches.Enemies
{
[HarmonyPatch(typeof(BaboonBirdAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class BaboonBirdAIPatch
{
private static string name = "BaboonBirdAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(BlobAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class BlobAIPatch
{
private static string name = "BlobAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(BushWolfEnemy))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class BushWolfEnemyPatch
{
private static string name = "BushWolfEnemy";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = 0;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Brfalse))
{
continue;
}
num3++;
if (num3 != 7)
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(ButlerBeesEnemyAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class ButlerBeesEnemyAIPatch
{
private static string name = "ButlerBeesEnemyAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = 0;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Brfalse))
{
continue;
}
num3++;
if (num3 != 2)
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(ButlerEnemyAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class ButlerEnemyAIPatch
{
private static string name = "ButlerEnemyAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = 0;
int num4 = 0;
Label label = il.DefineLabel();
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode.Equals(OpCodes.Beq))
{
num4++;
if (num4 == 2)
{
list[i].operand = label;
break;
}
}
}
for (int j = 0; j < list.Count; j++)
{
if (!list[j].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num3++;
if (num3 != 3)
{
continue;
}
num = j + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int k = num; k < list.Count; k++)
{
if (list[k].opcode.Equals(OpCodes.Callvirt))
{
num2 = k;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
for (int l = num - 1; l <= num2; l++)
{
list[l].opcode = OpCodes.Nop;
}
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num - 1, list.Count - num + 1);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
CodeInstruction val = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
val.labels.Add(label);
list2.Add(val);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(CaveDwellerAI))]
[HarmonyPatch("KillPlayerAnimationClientRpc")]
internal class CaveDwellerAIPatch
{
private static string name = "CaveDwellerAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = 0;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Brfalse))
{
continue;
}
num3++;
if (num3 != 5)
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosion5x");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(CentipedeAI))]
[HarmonyPatch("DamagePlayerOnIntervals")]
internal class CentipedeAIPatch
{
private static string name = "CentipedeAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = 0;
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode.Equals(OpCodes.Ldfld))
{
num3++;
}
if (num3 != 8)
{
continue;
}
num = i + 1;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
for (int k = num; k <= num2; k++)
{
list[k].opcode = OpCodes.Nop;
}
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(ClaySurgeonAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class ClaySurgeonAIPatch
{
private static string name = "ClaySurgeonAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Brfalse))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Ret))
{
num2 = j - 1;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
for (int k = num; k <= num2; k++)
{
list[k].opcode = OpCodes.Nop;
}
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(CrawlerAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class CrawlerAIPatch
{
private static string name = "CrawlerAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(GiantKiwiAI))]
[HarmonyPatch("AnimationEventB")]
internal class GiantKiwiAIPatch
{
private static string name = "GiantKiwiAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = 0;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num3++;
if (num3 != 3)
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j + 1;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(HoarderBugAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class HoarderBugAIPatch
{
private static string name = "HoarderBugAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(JesterAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class JesterAIPatch
{
private static string name = "JesterAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Call))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(MouthDogAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class MouthDogAIPatch
{
private static string name = "MouthDogAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Bne_Un))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Call))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(NutcrackerEnemyAI))]
[HarmonyPatch("LegKickPlayer")]
internal class NutcrackerEnemyAIPatch
{
private static string name = "NutcrackerEnemyAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stloc_1))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(PufferAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class PufferAIPatch
{
private static string name = "PufferAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(RadMechAI))]
[HarmonyPatch("Stomp")]
internal class RadMechAIPatchA
{
private static string name = "RadMechAI.Stomp";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Expected O, but got Unknown
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Expected O, but got Unknown
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Expected O, but got Unknown
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Expected O, but got Unknown
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Expected O, but got Unknown
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Expected O, but got Unknown
//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Expected O, but got Unknown
//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Expected O, but got Unknown
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Expected O, but got Unknown
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Expected O, but got Unknown
//IL_044e: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Expected O, but got Unknown
//IL_0469: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = -1;
int num4 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Mul))
{
continue;
}
num = i + 3;
Plugin.mls.LogDebug((object)$"{name}#1 startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name}#1 endIndex: {num2}");
break;
}
}
break;
}
for (int k = num; k < list.Count; k++)
{
if (!list[k].opcode.Equals(OpCodes.Mul))
{
continue;
}
num3 = k + 3;
Plugin.mls.LogDebug((object)$"{name}#2 startIndex: {num3}");
for (int l = num3; l < list.Count; l++)
{
if (list[l].opcode.Equals(OpCodes.Callvirt))
{
num4 = l;
Plugin.mls.LogDebug((object)$"{name}#2 endIndex: {num4}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
for (int m = num - 1; m <= num2; m++)
{
list[m].opcode = OpCodes.Nop;
}
}
if (num4 != -1 && num4 != -1)
{
for (int n = num3 - 1; n <= num4; n++)
{
list[n].opcode = OpCodes.Nop;
}
}
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
int num5 = -1;
for (int num6 = 0; num6 < list.Count; num6++)
{
if (list[num6].opcode.Equals(OpCodes.Nop))
{
num5 = num6;
list.Insert(num5, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)getMethod));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)method));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)getMethod));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)method2));
num5++;
break;
}
}
for (int num7 = num5; num7 < list.Count && list[num7].opcode.Equals(OpCodes.Nop); num7++)
{
}
for (int num8 = num5; num8 < list.Count; num8++)
{
if (list[num8].opcode.Equals(OpCodes.Nop))
{
num5 = num8;
list.Insert(num5, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)getMethod));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)method));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)getMethod));
num5++;
list.Insert(num5, new CodeInstruction(OpCodes.Call, (object)method2));
num5++;
break;
}
}
return list.AsEnumerable();
}
}
[HarmonyPatch(typeof(RadMechAI))]
[HarmonyPatch("BeginTorchPlayer")]
internal class RadMechAIPatchB
{
private static string name = "RadMechAI.BeginTorchPlayer";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
int num3 = 0;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Ldfld))
{
continue;
}
num3++;
if (num3 != 13)
{
continue;
}
num = i + 3;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Stfld))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
for (int k = num - 1; k <= num2; k++)
{
list[k].opcode = OpCodes.Nop;
}
}
List<CodeInstruction> range = list.GetRange(0, num2 - 1);
List<CodeInstruction> range2 = list.GetRange(num2, list.Count - num2);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(RedLocustBees))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class RedLocustBeesPatch
{
private static string name = "RedLocustBees";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
Label label = il.DefineLabel();
int num3 = 0;
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode.Equals(OpCodes.Brfalse))
{
num3++;
if (num3 == 2)
{
list[i].operand = label;
}
}
}
for (int j = 0; j < list.Count; j++)
{
if (!list[j].opcode.Equals(OpCodes.Br))
{
continue;
}
num = j + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int k = num; k < list.Count; k++)
{
if (list[k].opcode.Equals(OpCodes.Callvirt))
{
num2 = k;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
CodeInstruction val = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
val.labels.Add(label);
list2.Add(val);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(SandSpiderAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class SandSpiderAIPatch
{
private static string name = "SandSpiderAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
[HarmonyPatch(typeof(SpringManAI))]
[HarmonyPatch("OnCollideWithPlayer")]
internal class SpringManAIPatch
{
private static string name = "SpringManAI";
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
int num2 = -1;
for (int i = 0; i < list.Count; i++)
{
if (!list[i].opcode.Equals(OpCodes.Stfld))
{
continue;
}
num = i + 2;
Plugin.mls.LogDebug((object)$"{name} startIndex: {num}");
for (int j = num; j < list.Count; j++)
{
if (list[j].opcode.Equals(OpCodes.Callvirt))
{
num2 = j;
Plugin.mls.LogDebug((object)$"{name} endIndex: {num2}");
break;
}
}
break;
}
if (num != -1 && num2 != -1)
{
list.RemoveRange(num, num2 - num + 1);
}
List<CodeInstruction> range = list.GetRange(0, num - 1);
List<CodeInstruction> range2 = list.GetRange(num, list.Count - num);
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo getMethod = typeof(NetworkBehaviour).GetProperty("NetworkObject").GetMethod;
MethodInfo method = typeof(VENetworker).GetMethod("SpawnExplosionEnemy");
MethodInfo method2 = typeof(VENetworker).GetMethod("DespawnEnemy");
list2.AddRange(range);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Callvirt, method);
ILExtensions.Add(list2, OpCodes.Ldarg_0);
list2.Add(OpCodes.Call, getMethod);
list2.Add(OpCodes.Call, method2);
list2.AddRange(range2);
Plugin.mls.LogDebug((object)("Successfully patched " + name + "!"));
return list2.AsEnumerable();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace volatileEmployees.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}