using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GlobalSettings;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AlwaysLongNeedle")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AlwaysLongNeedle")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("68baf9d2-00a2-4ae2-a121-99eb357cc224")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.arbaz9234.alwayslongneedle", "Always Long Needle", "1.1.0")]
[BepInProcess("Hollow Knight Silksong.exe")]
public class AlwaysLongNeedle : BaseUnityPlugin
{
[HarmonyPatch(typeof(ToolItem), "get_IsEquipped")]
private static class ToolItem_IsEquipped_LongNeedlePatch
{
private static void Postfix(ToolItem __instance, ref bool __result)
{
if ((Object)(object)__instance == (Object)(object)Gameplay.LongNeedleTool)
{
__result = true;
}
}
}
[HarmonyPatch(typeof(NailAttackBase), "OnSlashStarting")]
private static class NailAttackBase_OnSlashStarting_Patch
{
private static void Postfix(NailAttackBase __instance)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
float rangeMultiplier = GetRangeMultiplier();
if (rangeMultiplier <= 1f)
{
return;
}
GameObject gameObject = ((Component)__instance).gameObject;
if (!((Object)(object)gameObject == (Object)null))
{
if (!originalScales.ContainsKey(gameObject))
{
originalScales[gameObject] = gameObject.transform.localScale;
}
Vector3 val = originalScales[gameObject];
gameObject.transform.localScale = val * rangeMultiplier;
}
}
}
[HarmonyPatch(typeof(NailAttackBase), "CancelAttack")]
private static class NailAttackBase_CancelAttack_Patch
{
private static void Postfix(NailAttackBase __instance)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)__instance).gameObject;
if (!((Object)(object)gameObject == (Object)null) && originalScales.TryGetValue(gameObject, out var value))
{
gameObject.transform.localScale = value;
originalScales.Remove(gameObject);
}
}
}
internal static ManualLogSource Log;
internal static ConfigEntry<string> RangeMultiplierString;
private static readonly Dictionary<GameObject, Vector3> originalScales = new Dictionary<GameObject, Vector3>();
private void Awake()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
RangeMultiplierString = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Needle Range Multiplier", "Normal (1x)", new ConfigDescription("Increase needle damage range", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Normal (1x)", "1.5x", "2x" }), Array.Empty<object>()));
new Harmony("com.arbaz9234.alwayslongneedle").PatchAll();
Log.LogInfo((object)"Always Long Needle v1.1.0 loaded");
}
internal static float GetRangeMultiplier()
{
string value = RangeMultiplierString.Value;
string text = value;
string text2 = text;
if (!(text2 == "1.5x"))
{
if (text2 == "2x")
{
return 1.2f;
}
return 1f;
}
return 1.1f;
}
}