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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("NotNite")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+78f676f5a93ffcf29e5e6354f1a068c6e8b7d660")]
[assembly: AssemblyProduct("FirstPersonFunk")]
[assembly: AssemblyTitle("FirstPersonFunk")]
[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.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;
}
}
[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 FirstPersonFunk
{
[BepInPlugin("FirstPersonFunk", "FirstPersonFunk", "1.0.0")]
[BepInProcess("Bomb Rush Cyberfunk.exe")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Log;
public static Harmony Harmony;
public static ConfigEntry<bool> ShowPlayer;
public static ConfigEntry<bool> RotateWithHead;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Harmony = new Harmony("FirstPersonFunk.Harmony");
Harmony.PatchAll();
ShowPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowPlayer", true, "Whether to show the player character in first person mode.");
RotateWithHead = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RotateWithHead", false, "Whether to rotate the camera with the player's head, or to only move it when you move it.");
}
private void Update()
{
if (!ShowPlayer.Value && !((Object)(object)WorldHandler.instance == (Object)null))
{
Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
if (!((Object)(object)currentPlayer == (Object)null))
{
((Renderer)currentPlayer.characterVisual.mainRenderer).enabled = (Object)(object)currentPlayer.cam == (Object)null;
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "FirstPersonFunk";
public const string PLUGIN_NAME = "FirstPersonFunk";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace FirstPersonFunk.Patches
{
[HarmonyPatch(typeof(GameplayCamera))]
public class GameplayCameraPatch
{
private static Vector2 Offset = new Vector2(0f, 0f);
[HarmonyPrefix]
[HarmonyPatch("UpdateCamera")]
public static bool UpdateCamera(GameplayCamera __instance)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
__instance.UpdateCameraInput();
Transform transform = ((Component)__instance).transform;
Transform headTf = __instance.player.headTf;
transform.position = headTf.position;
Vector2 val = __instance.orbitInput * (__instance.mouseForOrbit ? __instance.mouseFactor : __instance.joystickFactor);
if (Plugin.RotateWithHead.Value)
{
Offset.x += val.x;
Offset.y += val.y;
Offset.y = Clamp(Offset.y);
Quaternion val2 = Quaternion.Euler(new Vector3(Offset.y, Offset.x, 0f));
Quaternion val3 = headTf.rotation * Quaternion.Euler(new Vector3(0f, 0f, 90f));
transform.rotation = val3 * val2;
}
else
{
Quaternion rotation = transform.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
eulerAngles.x += val.y;
eulerAngles.y += val.x;
eulerAngles.z = 0f;
eulerAngles.x = Clamp(eulerAngles.x);
transform.rotation = Quaternion.Euler(eulerAngles);
}
return false;
}
private static float Clamp(float wtf)
{
wtf = ((wtf > 180f) ? (wtf - 360f) : wtf);
wtf = Mathf.Clamp(wtf, -89f, 89f);
return (wtf + 360f) % 360f;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}