Decompiled source of VerticallyChallenged v1.1.0

VerticallyChallenged.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("VerticallyChallenged")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VerticallyChallenged")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5ccf48b-12ba-4067-9900-6242682d9d28")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace VerticallyChallenged
{
	public class PluginConfig
	{
		public static ConfigEntry<bool> IsModEnabled { get; private set; }

		public static void BindConfig(ConfigFile config)
		{
			IsModEnabled = config.Bind<bool>("_Global", "isModEnabled", true, "Globally enable or disable this mod.");
		}
	}
	[BepInPlugin("bruce.valheim.comfymods.verticallychalleneged", "VerticallyChallenged", "1.1.0")]
	public class VerticallyChallenged : BaseUnityPlugin
	{
		public const string PluginGuid = "bruce.valheim.comfymods.verticallychalleneged";

		public const string PluginName = "VerticallyChallenged";

		public const string PluginVersion = "1.1.0";

		private Harmony _harmony;

		public void Awake()
		{
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
			_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "bruce.valheim.comfymods.verticallychalleneged");
		}

		public void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace VerticallyChallenged.Patches
{
	[HarmonyPatch(typeof(Attack))]
	internal static class AttackPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("DoMeleeAttack")]
		private static void DoMeleeAttackPrefix(ref Attack __instance)
		{
			Character val = default(Character);
			if (PluginConfig.IsModEnabled.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && ((Component)Player.m_localPlayer).TryGetComponent<Character>(ref val) && !((Object)(object)__instance.m_character != (Object)(object)val))
			{
				__instance.m_maxYAngle = 180f;
				__instance.m_attackHeight = 1f;
			}
		}
	}
}