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 AcolyteHarvesterTuning v1.0.1
AcolyteHarvesterTuning.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using EntityStates; using EntityStates.Acolyte.Backpack; using HarmonyLib; using Microsoft.CodeAnalysis; 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("AcolyteHarvesterTuning")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("AcolyteHarvesterTuning")] [assembly: AssemblyTitle("AcolyteHarvesterTuning")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 AcolyteHarvesterTuning { [BepInPlugin("AcolyteHarvesterTuning", "Acolyte Harvester Tuning", "1.0.1")] public class AcolyteHarvesterTuningPlugin : BaseUnityPlugin { public const string PluginGuid = "AcolyteHarvesterTuning"; public const string PluginName = "Acolyte Harvester Tuning"; public const string PluginVersion = "1.0.1"; internal static float SecondsPerLysate { get; private set; } internal static float StatBonus { get; private set; } internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; SecondsPerLysate = ((BaseUnityPlugin)this).Config.Bind<float>("Lysate", "SecondsPerStack", 2f, "Seconds added to Dark Summons for each Lysate Cell. Anima Echo is unchanged. Lysate Cell no longer adds Special charges on Acolyte.").Value; StatBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Harvester", "StatBonus", 0.2f, "While in Anima Harvester form, a stat the form already raises has that raise increased by this fraction. A stat it does not raise is multiplied by 1 plus this fraction.").Value; new Harmony("AcolyteHarvesterTuning").PatchAll(typeof(AcolyteHarvesterTuningPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Dark Summons gains Lysate duration, and Harvester stats are boosted."); } internal static int LysateCount(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return 0; } ItemDef equipmentMagazineVoid = Items.EquipmentMagazineVoid; if (!Object.op_Implicit((Object)(object)equipmentMagazineVoid)) { return 0; } return body.inventory.GetItemCountEffective(equipmentMagazineVoid); } internal static bool IsAcolyte(CharacterBody body) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return false; } BodyIndex val = BodyCatalog.FindBodyIndex("AcolyteBody"); return (int)val != -1 && body.bodyIndex == val; } } [HarmonyPatch(typeof(ReaperActivate), "OnEnter")] internal static class DarkSummonsDurationPatch { private static void Prefix(ReaperActivate __instance) { CharacterBody body = (Object.op_Implicit((Object)(object)((EntityState)__instance).outer) ? ((Component)((EntityState)__instance).outer).GetComponent<CharacterBody>() : null); int num = AcolyteHarvesterTuningPlugin.LysateCount(body); if (num > 0) { ((BaseBackpackState)__instance).duration = ((BaseBackpackState)__instance).duration + AcolyteHarvesterTuningPlugin.SecondsPerLysate * (float)num; } } } [HarmonyPatch(typeof(GenericSkill), "SetBonusStockFromBody")] internal static class LysateSacrificeChargePatch { [HarmonyPriority(0)] private static void Prefix(GenericSkill __instance, ref int newBonusStockFromBody) { if (newBonusStockFromBody <= 0) { return; } CharacterBody characterBody = __instance.characterBody; if (AcolyteHarvesterTuningPlugin.IsAcolyte(characterBody) && Object.op_Implicit((Object)(object)characterBody.skillLocator) && !((Object)(object)characterBody.skillLocator.specialBonusStockSkill != (Object)(object)__instance)) { int num = AcolyteHarvesterTuningPlugin.LysateCount(characterBody); if (num > 0 && newBonusStockFromBody >= num) { newBonusStockFromBody -= num; } } } } [HarmonyPatch(typeof(AcolyteBodySwapController), "Awake")] internal static class HarvesterStatPatch { private static readonly ConditionalWeakTable<AcolyteBodySwapController, object> Adjusted = new ConditionalWeakTable<AcolyteBodySwapController, object>(); private static readonly object Marker = new object(); private static readonly string[] StatFields = new string[11] { "baseMaxHealth", "baseMaxShield", "baseRegen", "baseMoveSpeed", "baseAcceleration", "baseJumpPower", "baseDamage", "baseAttackSpeed", "baseCrit", "baseArmor", "sprintingSpeedMultiplier" }; private static void Postfix(AcolyteBodySwapController __instance) { if (Adjusted.TryGetValue(__instance, out var _)) { return; } Adjusted.Add(__instance, Marker); float statBonus = AcolyteHarvesterTuningPlugin.StatBonus; for (int i = 0; i < StatFields.Length; i++) { string text = StatFields[i]; FieldInfo fieldInfo = AccessTools.Field(typeof(AcolyteBodySwapController), text); FieldInfo fieldInfo2 = AccessTools.Field(typeof(AcolyteBodySwapController), text + "Cached"); if (fieldInfo == null || fieldInfo2 == null) { AcolyteHarvesterTuningPlugin.Log.LogWarning((object)("Missing Harvester stat field " + text)); continue; } float harvester = (float)fieldInfo.GetValue(__instance); float acolyte = (float)fieldInfo2.GetValue(__instance); fieldInfo.SetValue(__instance, Adjust(acolyte, harvester, statBonus)); } } internal static float Adjust(float acolyte, float harvester, float bonus) { if (harvester > acolyte + 0.01f) { return acolyte + (harvester - acolyte) * (1f + bonus); } return harvester * (1f + bonus); } } }