Decompiled source of Railgunner Wallhacks v1.0.0

plugins/RailgunnerWallshot/RailgunnerWallshot.dll

Decompiled a day ago
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using EntityStates;
using EntityStates.Railgunner.Scope;
using EntityStates.Railgunner.Weapon;
using HarmonyLib;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace RailgunnerWallshot;

[BepInPlugin("wreckzog.railgunnerwallshot", "Railgunner Wallhacks", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
	private Harmony harmony;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		harmony = new Harmony("wreckzog.railgunnerwallshot");
		harmony.PatchAll(typeof(Plugin).Assembly);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Railgunner Wallhacks ready: rifle shots and scoped specials ignore terrain.");
	}

	private void OnDestroy()
	{
		if (harmony != null)
		{
			harmony.UnpatchSelf();
		}
	}
}
[HarmonyPatch(typeof(BaseFireSnipe), "ModifyBullet")]
internal static class ScopedTerrainPenetration
{
	[HarmonyPriority(0)]
	private static void Postfix(BaseFireSnipe __instance, BulletAttack bulletAttack)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		if (bulletAttack != null && Eligible(__instance))
		{
			int num = LayerMask.op_Implicit(bulletAttack.hitMask);
			LayerIndex world = LayerIndex.world;
			bulletAttack.hitMask = LayerMask.op_Implicit(num & ~LayerMask.op_Implicit(((LayerIndex)(ref world)).mask));
			int num2 = LayerMask.op_Implicit(bulletAttack.stopperMask);
			world = LayerIndex.world;
			bulletAttack.stopperMask = LayerMask.op_Implicit(num2 & ~LayerMask.op_Implicit(((LayerIndex)(ref world)).mask));
		}
	}

	internal static bool Eligible(BaseFireSnipe state)
	{
		if (state == null)
		{
			return false;
		}
		if (state is FireSnipeHeavy || state is FireSnipeLight)
		{
			return true;
		}
		if (!Object.op_Implicit((Object)(object)((EntityState)state).outer))
		{
			return false;
		}
		EntityStateMachine[] components = ((Component)((EntityState)state).outer).GetComponents<EntityStateMachine>();
		foreach (EntityStateMachine val in components)
		{
			if (val.state is BaseActive)
			{
				return true;
			}
		}
		return false;
	}
}