Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EquipdroneStrikelings v0.9.0
EquipdroneStrikelings.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using RoR2; 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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EquipdroneStrikelings")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a4de7b57956c4e6a144c5b1c094f963d448bc08d")] [assembly: AssemblyProduct("EquipdroneStrikelings")] [assembly: AssemblyTitle("EquipdroneStrikelings")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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; } } } public class MinionTracker : MonoBehaviour { public List<CharacterMaster> StrikeDrones = new List<CharacterMaster>(); public bool HasStrikeDrone() { foreach (CharacterMaster item in from master in StrikeDrones.ToList() where !Object.op_Implicit((Object)(object)master) select master) { StrikeDrones.Remove(item); } return StrikeDrones.Count > 0; } } namespace EquipdroneStrikelings { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("icebro.EquipdroneStrikelings", "EquipdroneStrikelings", "0.9.0")] public class EquipdroneStrikelings : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__4_1; public static Func<Instruction, bool> <>9__4_2; public static Func<Instruction, bool> <>9__4_3; public static Manipulator <>9__4_0; internal void <Awake>b__4_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 3f) })) { val.Index -= 3; val.RemoveRange(9); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_S, val.Method.Body.Variables[12]); val.Emit(OpCodes.Call, (MethodBase)typeof(EquipdroneStrikelings).GetMethod("EquipmentDroneCheck")); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } } internal bool <Awake>b__4_1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, 1); } internal bool <Awake>b__4_2(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 0f); } internal bool <Awake>b__4_3(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 3f); } } public const string PluginGUID = "icebro.EquipdroneStrikelings"; public const string PluginAuthor = "icebro"; public const string PluginName = "EquipdroneStrikelings"; public const string PluginVersion = "0.9.0"; public void Awake() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); EquipmentSlot.FireDroneBackup += new hook_FireDroneBackup(EquipmentSlotOnFireDroneBackup); object obj = <>c.<>9__4_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 3f) })) { val2.Index -= 3; val2.RemoveRange(9); val2.Emit(OpCodes.Ldarg_0); val2.Emit(OpCodes.Ldloc_S, val2.Method.Body.Variables[12]); val2.Emit(OpCodes.Call, (MethodBase)typeof(EquipdroneStrikelings).GetMethod("EquipmentDroneCheck")); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } }; <>c.<>9__4_0 = val; obj = (object)val; } EquipmentSlot.FireDroneBackup += (Manipulator)obj; } public static void EquipmentDroneCheck(EquipmentSlot equipslot, CharacterMaster master) { string name = ((Object)equipslot.characterBody).name; if (!name.Contains("EquipmentDrone")) { ((Component)master).gameObject.AddComponent<MasterSuicideOnTimer>().lifeTimer = 25f + Random.Range(0f, 3f); return; } MinionTracker component = ((Component)equipslot.characterBody).gameObject.GetComponent<MinionTracker>(); if (!Object.op_Implicit((Object)(object)component)) { ((Component)equipslot.characterBody).gameObject.AddComponent<MinionTracker>().StrikeDrones.Add(master); } else { component.StrikeDrones.Add(master); } } private bool EquipmentSlotOnFireDroneBackup(orig_FireDroneBackup orig, EquipmentSlot self) { CharacterBody characterBody = self.characterBody; CharacterMaster val = ((characterBody != null) ? characterBody.master : null); if (Object.op_Implicit((Object)(object)val) && ((Object)self.characterBody).name.Contains("EquipmentDrone")) { MinionTracker component = ((Component)self.characterBody).GetComponent<MinionTracker>(); if (component != null && component.HasStrikeDrone()) { return false; } } return orig.Invoke(self); } private bool EquipmentSlotOnPerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { Log.Debug("base name " + ((Object)self.characterBody).name + " name token " + self.characterBody.baseNameToken); return orig.Invoke(self, equipmentDef); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }