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 MoreReach v1.0.0
BetterAttack.dll
Decompiled 5 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BetterAttack")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterAttack")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ccdd6c58-4070-4144-a4a8-116a037e3590")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BetterAttack; [BepInPlugin("Essen.BetterAttack", "BetterAttack", "1.0.0")] public sealed class BetterAttackPlugin : BaseUnityPlugin { private const string PluginGuid = "Essen.BetterAttack"; private const string PluginName = "BetterAttack"; private const string PluginVersion = "1.0.0"; internal static ConfigEntry<float> ShovelEnemyRange; internal static ConfigEntry<float> KnifeEnemyRange; private void Awake() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) ShovelEnemyRange = ((BaseUnityPlugin)this).Config.Bind<float>("Attack Range", "Shovel Enemy Range", 1.5f, "삽의 몬스터 공격 거리(미터). 플레이어 공격 거리는 기본값으로 유지됩니다."); KnifeEnemyRange = ((BaseUnityPlugin)this).Config.Bind<float>("Attack Range", "Knife Enemy Range", 0.75f, "식칼의 몬스터 공격 거리(미터). 플레이어 공격 거리는 기본값으로 유지됩니다."); new Harmony("Essen.BetterAttack").PatchAll(typeof(BetterAttackPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"BetterAttack loaded: extended shovel and knife reach applies to enemies only."); } internal static RaycastHit[] SphereCastForShovel(Vector3 origin, float radius, Vector3 direction, float vanillaDistance, int layerMask, QueryTriggerInteraction query) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) float extendedDistance = Mathf.Max(vanillaDistance, ShovelEnemyRange.Value); return KeepEnemyHitsBeyondVanillaRange(origin, radius, direction, vanillaDistance, extendedDistance, layerMask, query); } internal static RaycastHit[] SphereCastForKnife(Vector3 origin, float radius, Vector3 direction, float vanillaDistance, int layerMask, QueryTriggerInteraction query) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) float extendedDistance = Mathf.Max(vanillaDistance, KnifeEnemyRange.Value); return KeepEnemyHitsBeyondVanillaRange(origin, radius, direction, vanillaDistance, extendedDistance, layerMask, query); } private static RaycastHit[] KeepEnemyHitsBeyondVanillaRange(Vector3 origin, float radius, Vector3 direction, float vanillaDistance, float extendedDistance, int layerMask, QueryTriggerInteraction query) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = Physics.SphereCastAll(origin, radius, direction, extendedDistance, layerMask, query); List<RaycastHit> list = new List<RaycastHit>(array.Length); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit item = array2[i]; bool flag = (Object)(object)((RaycastHit)(ref item)).transform != (Object)null && (Object)(object)((Component)((RaycastHit)(ref item)).transform).GetComponent<EnemyAICollisionDetect>() != (Object)null; if (((RaycastHit)(ref item)).distance <= vanillaDistance || flag) { list.Add(item); } } return list.ToArray(); } internal static IEnumerable<CodeInstruction> ReplaceSphereCast(IEnumerable<CodeInstruction> instructions, MethodInfo replacement) { MethodInfo sphereCast = AccessTools.Method(typeof(Physics), "SphereCastAll", new Type[6] { typeof(Vector3), typeof(float), typeof(Vector3), typeof(float), typeof(int), typeof(QueryTriggerInteraction) }, (Type[])null); foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Call && instruction.operand is MethodInfo methodInfo && methodInfo == sphereCast) { instruction.operand = replacement; } yield return instruction; } } } [HarmonyPatch(typeof(Shovel), "HitShovel")] internal static class ShovelRangePatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return BetterAttackPlugin.ReplaceSphereCast(instructions, AccessTools.Method(typeof(BetterAttackPlugin), "SphereCastForShovel", (Type[])null, (Type[])null)); } } [HarmonyPatch(typeof(KnifeItem), "HitKnife")] internal static class KnifeRangePatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return BetterAttackPlugin.ReplaceSphereCast(instructions, AccessTools.Method(typeof(BetterAttackPlugin), "SphereCastForKnife", (Type[])null, (Type[])null)); } }