using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("FreeCamera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FreeCamera")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6d2d9900-ed96-4bdd-8502-dd889a282ab8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class Freecam_mod : MonoBehaviour
{
private bool freecam = false;
private Transform aim;
private Transform pos;
private GameObject player;
public float base_speed = 2f;
public float fast_upspeed = 2f;
public float mouse_sensivity = 1.5f;
private void Awake()
{
pos = ((Component)this).gameObject.transform.Find("Position");
aim = pos.Find("Crouch Position/Crawl Position/Aim");
player = GameObject.Find("Player");
Debug.Log((object)"Succeful spawned Freecam_mod!");
}
private float MathSprint()
{
if (Input.GetKey((KeyCode)304))
{
return fast_upspeed;
}
return 1f;
}
private void Apply(Vector3 val)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
Transform obj = pos;
obj.position += val * base_speed * MathSprint() * Time.deltaTime;
}
private void Update()
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)285))
{
freecam = !freecam;
((Behaviour)((Component)pos).gameObject.GetComponent<CameraPosition>()).enabled = !freecam;
((Behaviour)((Component)aim).gameObject.GetComponent<CameraAim>()).enabled = !freecam;
((Behaviour)player.GetComponent<PlayerController>()).enabled = !freecam;
}
if (freecam)
{
if (Input.GetKey((KeyCode)119))
{
Apply(aim.forward);
}
if (Input.GetKey((KeyCode)115))
{
Apply(-aim.forward);
}
if (Input.GetKey((KeyCode)97))
{
Apply(-aim.right);
}
if (Input.GetKey((KeyCode)100))
{
Apply(aim.right);
}
LookStep();
}
}
private void LookStep()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_003b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
float axis = Input.GetAxis("Mouse X");
float axis2 = Input.GetAxis("Mouse Y");
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(axis, axis2);
Quaternion localRotation = aim.localRotation;
Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles;
aim.localRotation = Quaternion.Euler(eulerAngles.x - val.y * mouse_sensivity, eulerAngles.y + val.x * mouse_sensivity, eulerAngles.z);
}
}
namespace FreeCamera;
[BepInPlugin("dev.coolchair.freecam", "Freecam", "1.0.1.0")]
public class freecam_mod_plugin : BaseUnityPlugin
{
public const string pluginGuid = "dev.coolchair.freecam";
public const string pluginName = "Freecam";
public const string pluginVersion = "1.0.1.0";
public void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("dev.coolchair.freecam");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello by chair6798!");
}
}
[HarmonyPatch(typeof(CameraUtils), "Start")]
public class freecam_mod_patcher
{
private static void Postfix(CameraUtils __instance)
{
((Component)__instance).gameObject.AddComponent<Freecam_mod>();
Debug.Log((object)"Freecam component added to Camera.");
}
}