// Reference: 0Harmony using HarmonyLib; using System.Collections.Generic; using System.Reflection.Emit; using System.Reflection; using UnityEngine; using System.Linq; using Facepunch; namespace Oxide.Plugins { [Info("No Incen AHeli", "ViolationHandler", "0.0.3")] [Description("Prevents usage of incen rockets in the Attack Helicopters.")] public class NoIncenAHeli : RustPlugin { private Harmony _harmonyInstance; private void Loaded() { _harmonyInstance = new Harmony("com.ViolationHandler" + Name); _harmonyInstance.Patch(AccessTools.Method(typeof(AttackHelicopterRockets), nameof(AttackHelicopterRockets.ItemFilter)), transpiler: new HarmonyMethod(typeof(NoIncenAttackHeli), nameof(NoIncenAttackHeli.Transpiler))); } private void Unload() { _harmonyInstance?.UnpatchAll(_harmonyInstance.Id); } public class NoIncenAttackHeli { internal static IEnumerable Transpiler(IEnumerable instructions, ILGenerator ilGenerator) { List list = instructions.ToList(); Label skip = ilGenerator.DefineLabel(); if (list[0].labels == null) list[0].labels = new List