Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ArtificerQoL v0.1.1
ArtificerQoL.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using EntityStates; using EntityStates.Mage.Weapon; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using RoR2; using RoR2.Skills; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.0")] [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; } } } namespace Prototype { [BepInPlugin("prototype.artificer.qol", "ArtificerQoL", "0.1.1")] internal class ArtificerQoL : BaseUnityPlugin { public const string version = "0.1.1"; public const string identifier = "prototype.artificer.qol"; private static readonly Lazy<BodyIndex> index = new Lazy<BodyIndex>((Func<BodyIndex>)(() => BodyCatalog.FindBodyIndex(Survivors.Mage.cachedName + "Body"))); protected void Awake() { Harmony.CreateAndPatchAll(typeof(ArtificerQoL), (string)null); } [HarmonyPatch(typeof(CharacterBody), "RecalculateStats")] [HarmonyPostfix] private static void RecalculateStats(CharacterBody __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) GenericSkill primary = __instance.skillLocator.primary; if (__instance.bodyIndex == index.Value && Object.op_Implicit((Object)(object)primary) && primary.currentSkillOverride < 0 && (object)typeof(SkillDef).GetField("attackSpeedBuffsRestockSpeed") == null) { float num = 1f / primary.cooldownScale; num += 5f * (__instance.attackSpeed - 1f) / 6f; primary.cooldownScale = 1f / num; } } [HarmonyPatch(typeof(FireFireBolt), "OnEnter")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> OnEnter(IEnumerable<CodeInstruction> IL) { FieldInfo field = typeof(BaseState).GetField("attackSpeedStat", BindingFlags.Instance | BindingFlags.NonPublic); foreach (CodeInstruction instruction in IL) { yield return instruction; if (CodeInstructionExtensions.LoadsField(instruction, field, false)) { yield return new CodeInstruction(OpCodes.Ldc_R4, (object)1f); yield return new CodeInstruction(OpCodes.Sub, (object)null); yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.5f); yield return new CodeInstruction(OpCodes.Mul, (object)null); yield return new CodeInstruction(OpCodes.Ldc_R4, (object)1f); yield return new CodeInstruction(OpCodes.Add, (object)null); } } } [HarmonyPatch(typeof(BaseChargeBombState), "FixedUpdate")] [HarmonyILManipulator] private static void FixedUpdate(ILContext context) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_00ea: 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) PropertyInfo time = typeof(EntityState).GetProperty("fixedAge", BindingFlags.Instance | BindingFlags.NonPublic); PropertyInfo duration = typeof(BaseChargeBombState).GetProperty("duration", BindingFlags.Instance | BindingFlags.NonPublic); ILCursor val = new ILCursor(context); Func<Instruction, bool>[] array = new Func<Instruction, bool>[5] { (Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 0), (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, (MethodBase)time.GetMethod), (Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 0), (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, (MethodBase)duration.GetMethod), (Instruction instruction) => instruction.OpCode == OpCodes.Blt_Un_S }; val.GotoNext((MoveType)2, array); int num = val.Index - 1; val.Index = num; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_R4, float.NaN); } [HarmonyPatch(typeof(PrepWall), "OnEnter")] [HarmonyPostfix] private static void OnEnter(PrepWall __instance) { __instance.duration = PrepWall.baseDuration / 4f; } } }