Decompiled source of BetterAim v1.0.0

REPO_BetterAim.dll

Decompiled a week ago
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.Logging;
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("REPO_BetterAim")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("微软中国")]
[assembly: AssemblyProduct("REPO_BetterAim")]
[assembly: AssemblyCopyright("Copyright © 微软中国 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aad7ce60-f03d-40a0-934c-50f89675e3fd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace REPO_BetterAim;

[BepInPlugin("com.XiaohaoMod.REPO.BetterAim", "REPO.BetterAim", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string version = "1.0.0";

	public static Plugin instance;

	public static ManualLogSource logger;

	private void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		logger = ((BaseUnityPlugin)this).Logger;
		instance = this;
		logger.LogInfo((object)"小海更好的瞄准1.0.0 已成功加载!");
		new Harmony("XiaohaiMod.REPO.BetterAim").PatchAll();
	}
}
internal static class Patch
{
	[HarmonyPatch(typeof(PhysGrabObject))]
	private static class PhyGrabObjPatch
	{
		[HarmonyPatch("FixedUpdate")]
		[HarmonyPostfix]
		private static void FixedUpdate(PhysGrabObject __instance)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			ItemGun component = ((Component)__instance).GetComponent<ItemGun>();
			if (!((Object)(object)component == (Object)null))
			{
				PlayerAvatar val = SemiFunc.PlayerAvatarLocal();
				if (__instance.playerGrabbing.Contains(val.physGrabber))
				{
					component.aimVerticalOffset = -3f;
					float num = Mathf.Max(val.physGrabber.grabStrength / 2f, 0.5f);
					__instance.OverrideMass(num, 0.1f);
					__instance.OverrideGrabStrength(2f, 0.1f);
					__instance.OverrideTorqueStrength(5f, 0.1f);
					__instance.OverrideDrag(2f, 0.1f);
					__instance.rb.angularDrag = 10f;
					component.torqueMultiplier = 2f;
					Quaternion playerAim = PlayerController.instance.cameraAim.playerAim;
					__instance.rb.rotation = Quaternion.Slerp(__instance.rb.rotation, playerAim, 10f * Time.fixedDeltaTime);
					__instance.rb.constraints = (RigidbodyConstraints)80;
				}
				else
				{
					__instance.rb.constraints = (RigidbodyConstraints)0;
				}
			}
		}
	}
}