Decompiled source of NoMovementPenalty v1.0.4

NoMovementPenalty/NoMovementPenalty.dll

Decompiled 7 months 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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NoMovementPenalty")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoMovementPenalty")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("05078777-8b4c-43fd-98ec-887e0f886aae")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NoMovementPenalty;

[BepInPlugin("posixone_NoMovementPenalty", "NoMovementPenalty", "1.0.4")]
public class Main : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Player), "UpdateModifiers")]
	public class EquippedArmorDoesntAffectMovementSpeedMod
	{
		public static bool Prefix(ref float ___m_equipmentModifierValues, ref ItemData ___m_rightItem, ref ItemData ___m_leftItem, ref ItemData ___m_helmetItem, ref ItemData ___m_chestItem, ref ItemData ___m_legItem, ref ItemData ___m_shoulderItem, ref ItemData ___m_utilityItem)
		{
			if (___m_rightItem != null && rightItemEnable.Value && ___m_rightItem.m_shared.m_movementModifier < 0f)
			{
				___m_rightItem.m_shared.m_movementModifier = 1E-18f;
			}
			if (___m_leftItem != null && leftItemEnable.Value && ___m_leftItem.m_shared.m_movementModifier < 0f)
			{
				___m_leftItem.m_shared.m_movementModifier = 1E-18f;
			}
			if (___m_helmetItem != null && helmetItemEnable.Value && ___m_helmetItem.m_shared.m_movementModifier < 0f)
			{
				___m_helmetItem.m_shared.m_movementModifier = 1E-18f;
			}
			if (___m_chestItem != null && chestItemEnable.Value && ___m_chestItem.m_shared.m_movementModifier < 0f)
			{
				___m_chestItem.m_shared.m_movementModifier = 1E-18f;
			}
			if (___m_legItem != null && legItemEnable.Value && ___m_legItem.m_shared.m_movementModifier < 0f)
			{
				___m_legItem.m_shared.m_movementModifier = 1E-18f;
			}
			if (___m_shoulderItem != null && shoulderItemEnable.Value && ___m_shoulderItem.m_shared.m_movementModifier < 0f)
			{
				___m_shoulderItem.m_shared.m_movementModifier = 1E-18f;
			}
			if (___m_utilityItem != null && utilityItemEnable.Value && ___m_utilityItem.m_shared.m_movementModifier < 0f)
			{
				___m_utilityItem.m_shared.m_movementModifier = 1E-18f;
			}
			return true;
		}
	}

	public const string MODNAME = "NoMovementPenalty";

	public const string AUTHOR = "posixone";

	public const string GUID = "posixone_NoMovementPenalty";

	public const string VERSION = "1.0.4";

	public static ConfigEntry<bool> modEnable;

	public static ConfigEntry<bool> rightItemEnable;

	public static ConfigEntry<bool> leftItemEnable;

	public static ConfigEntry<bool> helmetItemEnable;

	public static ConfigEntry<bool> chestItemEnable;

	public static ConfigEntry<bool> legItemEnable;

	public static ConfigEntry<bool> shoulderItemEnable;

	public static ConfigEntry<bool> utilityItemEnable;

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_002c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		//IL_005c: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		//IL_008c: Expected O, but got Unknown
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00bc: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Expected O, but got Unknown
		//IL_00ec: Expected O, but got Unknown
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Expected O, but got Unknown
		//IL_011c: Expected O, but got Unknown
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Expected O, but got Unknown
		//IL_014c: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Expected O, but got Unknown
		//IL_017c: Expected O, but got Unknown
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Expected O, but got Unknown
		modEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("1-Global", "modEnable"), true, new ConfigDescription("Set this to true to enable and false to disable this mod.", (AcceptableValueBase)null, Array.Empty<object>()));
		rightItemEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("2-Toggles", "rightItemEnable"), true, new ConfigDescription("Set this to true to enable NoMovementPenalty for the equipped right-handed item.", (AcceptableValueBase)null, Array.Empty<object>()));
		leftItemEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("2-Toggles", "leftItemEnable"), true, new ConfigDescription("Set this to true to enable NoMovementPenalty for the equipped left-handed item.", (AcceptableValueBase)null, Array.Empty<object>()));
		helmetItemEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("2-Toggles", "helmetItemEnable"), true, new ConfigDescription("Set this to true to enable NoMovementPenalty for the equipped helmet item.", (AcceptableValueBase)null, Array.Empty<object>()));
		chestItemEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("2-Toggles", "chestItemEnable"), true, new ConfigDescription("Set this to true to enable NoMovementPenalty for the equipped chest item.", (AcceptableValueBase)null, Array.Empty<object>()));
		legItemEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("2-Toggles", "legItemEnable"), true, new ConfigDescription("Set this to true to enable NoMovementPenalty for the equipped leg item.", (AcceptableValueBase)null, Array.Empty<object>()));
		shoulderItemEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("2-Toggles", "shoulderItemEnable"), true, new ConfigDescription("Set this to true to enable NoMovementPenalty for the equipped shoulder item.", (AcceptableValueBase)null, Array.Empty<object>()));
		utilityItemEnable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("2-Toggles", "utilityItemEnable"), true, new ConfigDescription("Set this to true to enable NoMovementPenalty for the equipped utility item.", (AcceptableValueBase)null, Array.Empty<object>()));
		Harmony val = new Harmony("posixone_NoMovementPenalty");
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		if (modEnable.Value)
		{
			val.PatchAll(executingAssembly);
		}
	}
}