Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ProcLimiter v1.0.5
ProcLimiter.dll
Decompiled 3 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using RoR2; [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 = "")] [assembly: AssemblyCompany("ProcLimiter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ProcLimiter")] [assembly: AssemblyTitle("ProcLimiter")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ProcLimiter; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.ProcLimiter", "ProcLimiter", "1.0.0")] public class ProcLimiterPlugin : BaseUnityPlugin { public const string guid = "com.RiskOfBrainrot.ProcLimiter"; public const string teamName = "RiskOfBrainrot"; public const string modName = "ProcLimiter"; public const string version = "1.0.0"; public static PluginInfo PInfo { get; private set; } internal static ConfigFile CustomConfigFile { get; private set; } public static ConfigEntry<bool> DoBands { get; set; } public static ConfigEntry<bool> DoChronic { get; set; } public static ConfigEntry<bool> DoBoots { get; set; } private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\ProcSolver.cfg", true); DoBands = CustomConfigFile.Bind<bool>("Proc Limiter", "Bands Damage Source", true, "Should Proc Limiter disable band procs on non-skill or non-equipment sources?"); DoChronic = CustomConfigFile.Bind<bool>("Proc Limiter", "Chronic Expansion Damage Source", true, "Should Proc Limiter disable chronic expansion buff extension on non-skill or non-equipment sources?"); DoBoots = CustomConfigFile.Bind<bool>("Proc Limiter", "Hiker Boots Damage Source", true, "Should Proc Limiter disable Hiker Boots buff on non-skill or non-equipment sources?"); if (DoBands.Value) { GlobalEventManager.ProcessHitEnemy += new Manipulator(AddBandsSkillRequirement); } if (DoChronic.Value) { GlobalEventManager.ProcessHitEnemy += new Manipulator(AddChronicSkillRequirement); } if (DoBoots.Value) { GlobalEventManager.ProcessHitEnemy += new Manipulator(AddBootsSkillRequirement); } } private void AddBootsSkillRequirement(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC3Content/Items", "CritAtLowerElevation"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.Inventory", "GetItemCountEffective") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<int, DamageInfo, int>>((Func<int, DamageInfo, int>)((int itemCount, DamageInfo damageInfo) => (((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased || (int)damageInfo.damageType.damageSource == 64) ? itemCount : 0)); } } private void AddChronicSkillRequirement(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC2Content/Items", "IncreaseDamageOnMultikill"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.Inventory", "GetItemCountEffective") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<int, DamageInfo, int>>((Func<int, DamageInfo, int>)((int itemCount, DamageInfo damageInfo) => (((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased || (int)damageInfo.damageType.damageSource == 64) ? itemCount : 0)); } } private void AddBandsSkillRequirement(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 12), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.ProcChainMask", "HasProc") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<bool, DamageInfo, bool>>((Func<bool, DamageInfo, bool>)((bool cantProc, DamageInfo damageInfo) => cantProc || (!((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased && (int)damageInfo.damageType.damageSource != 64))); } } }