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 MithrixDeflect v1.0.1
MithrixDeflect.dll
Decompiled 5 days agousing System; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace MithrixDeflect; [BepInPlugin("binma.mithrixdeflect", "Mithrix Deflect", "1.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static ConfigEntry<bool> Taunt; internal static ConfigEntry<string> Lines; internal static ConfigEntry<bool> Extra; internal const string DefaultLines = "A trinket. You bring a TRINKET to me?|I am no trophy, vermin.|Your hunt ends here, worm.|Keep your prize. Grasp your death.|Only the weak become trophies.|You aim your little hunt at a god?|Did you expect me to kneel for a hat?|The hunter falls to the hunted.|You came for a trophy. Leave as one.|Nothing claims me. Nothing.|Kneel."; private void Awake() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Taunt = ((BaseUnityPlugin)this).Config.Bind<bool>("Mithrix", "Taunt in chat", true, "Mithrix mocks you in chat when he deflects the Tricorn."); Lines = ((BaseUnityPlugin)this).Config.Bind<string>("Mithrix", "Taunt lines", "A trinket. You bring a TRINKET to me?|I am no trophy, vermin.|Your hunt ends here, worm.|Keep your prize. Grasp your death.|Only the weak become trophies.|You aim your little hunt at a god?|Did you expect me to kneel for a hat?|The hunter falls to the hunted.|You came for a trophy. Leave as one.|Nothing claims me. Nothing.|Kneel.", "Lines he picks from at random, separated by |"); Extra = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Spent Nullifier leaves a husk", true, ""); new Harmony("binma.mithrixdeflect").PatchAll(typeof(Plugin).Assembly); } internal static string PickLine() { string[] array = (from l in (Lines.Value ?? "").Split('|') select l.Trim() into l where l.Length > 0 select l).ToArray(); if (array.Length == 0) { array = "A trinket. You bring a TRINKET to me?|I am no trophy, vermin.|Your hunt ends here, worm.|Keep your prize. Grasp your death.|Only the weak become trophies.|You aim your little hunt at a god?|Did you expect me to kneel for a hat?|The hunter falls to the hunted.|You came for a trophy. Leave as one.|Nothing claims me. Nothing.|Kneel.".Split('|'); } return array[Random.Range(0, array.Length)]; } } [HarmonyPatch(typeof(EquipmentSlot), "CallRpcBrotherParryBossHunter")] internal static class ParryTauntPatch { private static void Prefix(NetworkInstanceId __0) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown try { if (NetworkServer.active && Plugin.Taunt.Value) { SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "BROTHER_DIALOGUE_FORMAT"; val.paramTokens = new string[1] { Plugin.PickLine() }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } } catch (Exception ex) { Plugin.Log.LogError((object)ex); } } } [HarmonyPatch(typeof(Inventory), "SetEquipmentIndex", new Type[] { typeof(EquipmentIndex), typeof(bool) })] internal static class NullifierHuskPatch { private static EquipmentIndex nullifier = (EquipmentIndex)(-1); private static bool looked; private static void Prefix(Inventory __instance, ref EquipmentIndex newEquipmentIndex) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected I4, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) try { if (!Plugin.Extra.Value || !NetworkServer.active || (int)newEquipmentIndex != -1 || !Object.op_Implicit((Object)(object)__instance)) { return; } if (!looked) { looked = true; for (int i = 0; i < EquipmentCatalog.equipmentCount; i++) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)i); if (Object.op_Implicit((Object)(object)equipmentDef) && ((Object)equipmentDef).name != null && ((Object)equipmentDef).name.IndexOf("Nullifier", StringComparison.OrdinalIgnoreCase) >= 0) { nullifier = equipmentDef.equipmentIndex; break; } } } if ((int)nullifier != -1 && __instance.currentEquipmentIndex == nullifier) { EquipmentDef bossHunterConsumed = Equipment.BossHunterConsumed; if (Object.op_Implicit((Object)(object)bossHunterConsumed) && Object.op_Implicit((Object)(object)Run.instance) && (!Object.op_Implicit((Object)(object)bossHunterConsumed.requiredExpansion) || Run.instance.IsExpansionEnabled(bossHunterConsumed.requiredExpansion))) { newEquipmentIndex = (EquipmentIndex)(int)bossHunterConsumed.equipmentIndex; } } } catch (Exception ex) { Plugin.Log.LogError((object)ex); } } }