using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 Rewired;
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.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+cb298bc8dbd528e5e44db86c28bba7b9db2b27ce")]
[assembly: AssemblyProduct("BombRushCamera")]
[assembly: AssemblyTitle("BombRushCamera")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 BombRushCamera
{
public class Config
{
public class ConfigFreecam
{
public ConfigEntry<float> BaseSpeed = config.Bind<float>("Freecam", "BaseSpeed", 5f, "The speed you move at in freecam by default.");
public ConfigEntry<float> ShiftMultiplier = config.Bind<float>("Freecam", "ShiftMultiplier", 10f, "The speed multiplier when holding shift.");
public ConfigEntry<float> CtrlMultiplier = config.Bind<float>("Freecam", "CtrlMultiplier", 0.1f, "The speed multiplier when holding ctrl.");
public ConfigEntry<float> MouseSensitivity = config.Bind<float>("Freecam", "MouseSensitivity", 5f, "The mouse sensitivity when in freecam.");
public ConfigFreecam(ConfigFile config)
{
}
}
public class ConfigInput
{
public ConfigEntry<KeyCode> Key = config.Bind<KeyCode>("Input", "Key", (KeyCode)307, "Toggles freecam. Press to start, press to stop.");
public ConfigEntry<KeyCode> ToggleAnchorKey = config.Bind<KeyCode>("Input", "ToggleAnchorKey", (KeyCode)46, "Toggles between free movement and anchoring the camera to the player.");
public ConfigEntry<KeyCode> ToggleInputsKey = config.Bind<KeyCode>("Input", "ToggleInputsKey", (KeyCode)47, "Re-enables inputs when pressed in freecam.");
public ConfigInput(ConfigFile config)
{
}
}
public ConfigFreecam Freecam = new ConfigFreecam(config);
public ConfigInput Input = new ConfigInput(config);
public Config(ConfigFile config)
{
}
}
public class FreecamState
{
public Vector3 Transform = Vector3.zero;
public bool AnchoredTransform;
}
[BepInPlugin("BombRushCamera", "BombRushCamera", "1.1.0")]
[BepInProcess("Bomb Rush Cyberfunk.exe")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Log = null;
public static Config PluginConfig = null;
public static Harmony Harmony = null;
public static bool Active = false;
public static bool InputsDisabled = false;
public static List<int> RewiredMaps = new List<int>();
public static FreecamState? State = null;
private void Awake()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
PluginConfig = new Config(((BaseUnityPlugin)this).Config);
Harmony = new Harmony("BombRushCamera.Harmony");
Harmony.PatchAll();
}
private void Update()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(PluginConfig.Input.Key.Value))
{
Active = !Active;
InputsDisabled = Active;
ApplyInputs();
}
if (Active && Input.GetKeyDown(PluginConfig.Input.ToggleInputsKey.Value))
{
InputsDisabled = !InputsDisabled;
ApplyInputs();
}
}
private void ApplyInputs()
{
GameInput gameInput = Core.Instance.GameInput;
IEnumerable<int> source = from x in gameInput.rewiredMappingHandler.GetRewiredPlayer(0).controllers.maps.GetAllMaps()
where x.enabled
select x.id;
if (InputsDisabled)
{
if (RewiredMaps.Count == 0)
{
RewiredMaps = source.ToList();
}
gameInput.DisableAllControllerMaps(0);
return;
}
foreach (int rewiredMap in RewiredMaps)
{
gameInput.EnableControllerMap(rewiredMap, 0);
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "BombRushCamera";
public const string PLUGIN_NAME = "BombRushCamera";
public const string PLUGIN_VERSION = "1.1.0";
}
}
namespace BombRushCamera.Patches
{
[HarmonyPatch(typeof(GameplayCamera))]
public class GameplayCameraPatch
{
[HarmonyPrefix]
[HarmonyPatch("UpdateCamera")]
public static bool UpdateCamera(GameplayCamera __instance)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: 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_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.Active)
{
Transform transform = ((Component)__instance).transform;
Transform tf = __instance.player.tf;
bool keyDown = Input.GetKeyDown(Plugin.PluginConfig.Input.ToggleAnchorKey.Value);
if (Plugin.State == null || keyDown)
{
if (Plugin.State == null)
{
Plugin.State = new FreecamState
{
Transform = transform.position,
AnchoredTransform = false
};
}
if (keyDown)
{
Plugin.State.AnchoredTransform = !Plugin.State.AnchoredTransform;
if (Plugin.State.AnchoredTransform)
{
Plugin.State.Transform = transform.position - tf.position;
}
else
{
Plugin.State.Transform = transform.position;
}
}
}
Vector3 val = Plugin.State.Transform;
if (Plugin.InputsDisabled)
{
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(Input.GetAxis("Mouse X"), 0f - Input.GetAxis("Mouse Y"));
float value = Plugin.PluginConfig.Freecam.MouseSensitivity.Value;
Quaternion val3 = transform.rotation;
val3 *= Quaternion.Euler(val2.y * value, val2.x * value, 0f);
Vector3 eulerAngles = ((Quaternion)(ref val3)).eulerAngles;
eulerAngles.z = 0f;
float x = eulerAngles.x;
x = ((x > 180f) ? (x - 360f) : x);
x = Mathf.Clamp(x, -89f, 89f);
eulerAngles.x = (x + 360f) % 360f;
((Quaternion)(ref val3)).eulerAngles = eulerAngles;
transform.rotation = val3;
float num = Time.deltaTime * Plugin.PluginConfig.Freecam.BaseSpeed.Value;
if (Input.GetKey((KeyCode)304))
{
num *= Plugin.PluginConfig.Freecam.ShiftMultiplier.Value;
}
if (Input.GetKey((KeyCode)306))
{
num *= Plugin.PluginConfig.Freecam.CtrlMultiplier.Value;
}
if (Input.GetKey((KeyCode)119))
{
val += transform.forward * num;
}
if (Input.GetKey((KeyCode)115))
{
val -= transform.forward * num;
}
if (Input.GetKey((KeyCode)97))
{
val -= transform.right * num;
}
if (Input.GetKey((KeyCode)100))
{
val += transform.right * num;
}
}
Vector3 val4 = (Plugin.State.AnchoredTransform ? __instance.player.tf.position : Vector3.zero);
transform.position = val + val4;
Plugin.State.Transform = val;
return false;
}
return true;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}