using 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GunZ")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyInformationalVersion("0.0.2+50df5752f19fbb1ccfec2e05c497f6c23b05eb08")]
[assembly: AssemblyProduct("GunZ")]
[assembly: AssemblyTitle("GunZ")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.2.0")]
[module: UnverifiableCode]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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;
}
}
}
internal sealed class ConfigurationManagerAttributes
{
public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);
public bool? ShowRangeAsPercent;
public Action<ConfigEntryBase> CustomDrawer;
public CustomHotkeyDrawerFunc CustomHotkeyDrawer;
public bool? Browsable;
public string Category;
public object DefaultValue;
public bool? HideDefaultButton;
public bool? HideSettingName;
public string Description;
public string DispName;
public int? Order;
public bool? ReadOnly;
public bool? IsAdvanced;
public Func<object, string> ObjToStr;
public Func<string, object> StrToObj;
}
namespace GunZ
{
[BepInPlugin("bergbok.gunz", "GunZ", "0.0.2")]
[BepInProcess("Hollow Knight Silksong")]
public class GunZ : BaseUnityPlugin
{
[HarmonyPatch(typeof(HeroController), "Start")]
private static class HeroController_Start_Patch
{
[HarmonyPostfix]
private static void Postfix(HeroController __instance)
{
if (PluginEnabled.Value)
{
ApplyModifications(__instance);
}
}
}
[HarmonyPatch(typeof(HeroController), "Update")]
private static class HeroController_Update_Patch
{
[HarmonyPostfix]
private static void Postfix(HeroController __instance)
{
if (PluginEnabled.Value)
{
__instance.acceptingInput = true;
__instance.controlReqlinquished = false;
}
}
}
[HarmonyPatch]
private static class HeroController_Skips_Patch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(HeroController), "CanAttack")]
[HarmonyPatch(typeof(HeroController), "CanAttackAction")]
[HarmonyPatch(typeof(HeroController), "CanBackDash")]
[HarmonyPatch(typeof(HeroController), "CanBind")]
[HarmonyPatch(typeof(HeroController), "CanCast")]
[HarmonyPatch(typeof(HeroController), "CanDoFSMCancelMove")]
[HarmonyPatch(typeof(HeroController), "CanDoFsmMove")]
[HarmonyPatch(typeof(HeroController), "CanDoSpecial")]
[HarmonyPatch(typeof(HeroController), "CanDownAttack")]
[HarmonyPatch(typeof(HeroController), "CanInput")]
[HarmonyPatch(typeof(HeroController), "CanNailCharge")]
[HarmonyPatch(typeof(HeroController), "CanPlayNeedolin")]
[HarmonyPatch(typeof(HeroController), "CanSprint")]
[HarmonyPatch(typeof(HeroController), "CanStartWithThrowTool")]
[HarmonyPatch(typeof(HeroController), "CanSuperJump")]
[HarmonyPatch(typeof(HeroController), "CanTakeControl")]
[HarmonyPatch(typeof(HeroController), "CanTryHarpoonDash")]
[HarmonyPatch(typeof(HeroController), "DashCooldownReady")]
private static bool TruePrefix(HeroController __instance, ref bool __result)
{
if (!PluginEnabled.Value)
{
return true;
}
__result = true;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HeroController), "IsAttackLocked")]
[HarmonyPatch(typeof(HeroController), "IsDashLocked")]
[HarmonyPatch(typeof(HeroController), "IsInputBlocked")]
private static bool FalsePrefix(HeroController __instance, ref bool __result)
{
if (!PluginEnabled.Value)
{
return true;
}
__result = false;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HeroController), "DoSprintSkid")]
[HarmonyPatch(typeof(HeroController), "RelinquishControl")]
[HarmonyPatch(typeof(HeroController), "PreventShuttlecock")]
[HarmonyPatch(typeof(HeroController), "StartHarpoonDashCooldown")]
private static bool NoResultPrefix(HeroController __instance)
{
return !PluginEnabled.Value;
}
}
[HarmonyPatch(typeof(HeroController), "DidUseAttackTool")]
private static class HeroController_DidUseAttackTool_Patch
{
[HarmonyPrefix]
private static void Prefix(HeroController __instance, ref Data toolData)
{
if (PluginEnabled.Value)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"DidUseAttackTool called with toolData: {toolData.AmountLeft}");
}
}
}
internal static GunZ Instance;
internal static ConfigEntry<bool> PluginEnabled;
private static float originalDashCooldown;
private static float originalWallclingCooldown;
private static bool originalsStored;
private void Awake()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
PluginEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, (ConfigDescription)null);
PluginEnabled.SettingChanged += OnPluginEnabledChanged;
new Harmony("bergbok.gunz").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin loaded and initialized.");
}
private void OnPluginEnabledChanged(object sender, EventArgs e)
{
HeroController instance = HeroController.instance;
if (!((Object)(object)instance == (Object)null) && PluginEnabled.Value)
{
ApplyModifications(instance);
}
}
private static void ApplyModifications(HeroController hero)
{
if (!originalsStored)
{
originalDashCooldown = hero.DASH_COOLDOWN;
originalWallclingCooldown = hero.WALLCLING_COOLDOWN;
originalsStored = true;
}
hero.DASH_COOLDOWN = 0f;
hero.WALLCLING_COOLDOWN = 0f;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "bergbok.gunz";
public const string PLUGIN_NAME = "GunZ";
public const string PLUGIN_VERSION = "0.0.2";
}
}