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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("PunchTerminal")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allows you to make selections in the terminal by punching")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PunchTerminal")]
[assembly: AssemblyTitle("PunchTerminal")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace PunchTerminal
{
[BepInPlugin("com.earthlingOnFire.PunchTerminal", "PunchTerminal", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string PLUGIN_GUID = "com.earthlingOnFire.PunchTerminal";
public const string PLUGIN_NAME = "PunchTerminal";
public const string PLUGIN_VERSION = "1.0.0";
public static ManualLogSource logger;
private void Awake()
{
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
logger = ((BaseUnityPlugin)this).Logger;
}
private void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("com.earthlingOnFire.PunchTerminal").PatchAll();
logger.LogInfo((object)"Plugin com.earthlingOnFire.PunchTerminal is loaded!");
}
}
[HarmonyPatch]
public static class Patches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ControllerPointer), "UpdateEvents")]
private static void ControllerPointer_UpdateEvents_Prefix(ControllerPointer __instance)
{
//IL_001d: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
if (!ControllerPointer.bestResult.HasValue)
{
return;
}
RaycastResult value = ControllerPointer.bestResult.Value;
if ((Object)(object)((RaycastResult)(ref value)).gameObject == (Object)(object)((Component)__instance).gameObject && !MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && PunchWasPerformedThisFrame())
{
DoPunch();
__instance.pointerDown = true;
ExecuteEvents.Execute<IPointerDownHandler>(((Component)__instance).gameObject, (BaseEventData)(object)__instance.eventData, ExecuteEvents.pointerDownHandler);
ExecuteEvents.Execute<IPointerClickHandler>(((Component)__instance).gameObject, (BaseEventData)(object)__instance.eventData, ExecuteEvents.pointerClickHandler);
UnityEvent onPressed = __instance.onPressed;
if (onPressed != null)
{
onPressed.Invoke();
}
__instance.dragPoint = __instance.eventData.position;
}
if (__instance.pointerDown && PunchWasReleasedThisFrame())
{
__instance.pointerDown = false;
ExecuteEvents.Execute<IPointerUpHandler>(((Component)__instance).gameObject, (BaseEventData)(object)__instance.eventData, ExecuteEvents.pointerUpHandler);
UnityEvent onReleased = __instance.onReleased;
if (onReleased != null)
{
onReleased.Invoke();
}
}
}
private static bool PunchWasPerformedThisFrame()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
FistActions fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
int result;
if (!((FistActions)(ref fist)).Punch.WasPerformedThisFrame())
{
fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
if (!((FistActions)(ref fist)).PunchFeedbacker.WasPerformedThisFrame())
{
fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
result = (((FistActions)(ref fist)).PunchKnuckleblaster.WasPerformedThisFrame() ? 1 : 0);
goto IL_006b;
}
}
result = 1;
goto IL_006b;
IL_006b:
return (byte)result != 0;
}
private static bool PunchWasReleasedThisFrame()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
FistActions fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
int result;
if (!((FistActions)(ref fist)).Punch.WasReleasedThisFrame())
{
fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
if (!((FistActions)(ref fist)).PunchFeedbacker.WasReleasedThisFrame())
{
fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
result = (((FistActions)(ref fist)).PunchKnuckleblaster.WasReleasedThisFrame() ? 1 : 0);
goto IL_006b;
}
}
result = 1;
goto IL_006b;
IL_006b:
return (byte)result != 0;
}
private static void DoPunch()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
FistControl instance = MonoSingleton<FistControl>.Instance;
FistActions fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
if (((FistActions)(ref fist)).PunchFeedbacker.WasPerformedThisFrame())
{
instance.ArmChange(0);
}
else
{
fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
if (((FistActions)(ref fist)).PunchKnuckleblaster.WasPerformedThisFrame())
{
instance.ArmChange(1);
}
else
{
instance.RefreshArm();
}
}
Punch currentPunch = instance.currentPunch;
currentPunch.anim.SetFloat("PunchRandomizer", Random.Range(0f, 1f));
currentPunch.anim.SetTrigger("Punch");
currentPunch.aud.pitch = Random.Range(0.9f, 1.1f);
currentPunch.aud.Play();
MonoSingleton<RumbleManager>.Instance.SetVibration(RumbleProperties.Punch);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "PunchTerminal";
public const string PLUGIN_NAME = "PunchTerminal";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}