using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("freecam")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f73886837825477b05102ebe98501dbd63639cac")]
[assembly: AssemblyProduct("freecam")]
[assembly: AssemblyTitle("freecam")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace freecam;
[ContentWarningPlugin("raisin.plugin.freecam", "1.1.7", false)]
[BepInPlugin("raisin.plugin.freecam", "freecam", "1.1.7")]
public class Plugin : BaseUnityPlugin
{
public const string PLUGIN_GUID = "raisin.plugin.freecam";
public const string PLUGIN_VERSION = "1.1.7";
public static bool isFreeCam = false;
public static bool canFreeCam = false;
public static bool isHud = true;
public static GameObject head;
public static GameObject text;
public static GameObject text2electricboogaloo;
public static GameObject hud;
public static GameObject hat;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Freecam 1.1.7");
SceneManager.activeSceneChanged += SceneChanged;
Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
}
private void SceneChanged(Scene current, Scene next)
{
canFreeCam = ((Scene)(ref next)).name != "NewMainMenu";
isFreeCam = false;
head = null;
text = null;
text2electricboogaloo = null;
hud = null;
hat = null;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MainCameraMovement), "LateUpdate")]
public static bool CameraLateUpdatePatch()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "NewMainMenu")
{
return true;
}
if (Input.GetKeyDown((KeyCode)109))
{
isFreeCam = !isFreeCam;
}
if (Input.GetKeyDown((KeyCode)44))
{
isHud = !isHud;
}
if ((Object)(object)head == (Object)null)
{
head = ((Component)((Component)Player.localPlayer).transform.Find("CharacterModel/HeadRenderer")).gameObject;
}
if ((Object)(object)text == (Object)null)
{
text = ((Component)((Component)Player.localPlayer).transform.Find("HeadPosition/FACE")).gameObject;
}
if ((Object)(object)text2electricboogaloo == (Object)null && (Object)(object)text != (Object)null && text.transform.childCount > 0)
{
text2electricboogaloo = ((Component)text.transform.GetChild(0)).gameObject;
}
if ((Object)(object)hud == (Object)null)
{
hud = GameObject.Find("HelmetUI");
}
try
{
if ((Object)(object)hat == (Object)null)
{
hat = ((Component)((Component)((Component)Player.localPlayer).transform.Find("RigCreator/Rig/Armature/Hip/Torso/Head/HatPos")).transform.GetChild(0)).gameObject;
}
}
catch
{
}
hud.SetActive(isHud);
if (isFreeCam)
{
head.layer = 0;
text.layer = 0;
if ((Object)(object)text2electricboogaloo != (Object)null)
{
text2electricboogaloo.layer = 0;
}
if ((Object)(object)hat != (Object)null)
{
hat.layer = 0;
}
((Component)Camera.main).transform.Translate(new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical")) * 0.15f);
((Component)Camera.main).transform.rotation = Quaternion.LookRotation(Player.localPlayer.data.lookDirection);
}
else
{
head.layer = 29;
text.layer = 29;
if ((Object)(object)text2electricboogaloo != (Object)null)
{
text2electricboogaloo.layer = 29;
}
if ((Object)(object)hat != (Object)null)
{
hat.layer = 29;
}
((Component)Camera.main).transform.position = Player.localPlayer.refs.cameraPos.position;
((Component)Camera.main).transform.rotation = Player.localPlayer.refs.cameraPos.rotation;
}
return !isFreeCam;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(PlayerController), "Movement")]
[HarmonyPatch(typeof(PlayerController), "SimpleMovement")]
[HarmonyPatch(typeof(PlayerController), "TryJump")]
[HarmonyPatch(typeof(PlayerAnimationHandler), "SetAnimatorValues")]
[HarmonyPatch(typeof(PlayerAnimationHandler), "HandleAnimationTarget")]
[HarmonyPatch(typeof(PlayerItems), "FixedUpdate")]
[HarmonyPatch(typeof(PlayerItemsFake), "FixedUpdate")]
public static bool EarlyReturns(MonoBehaviour __instance)
{
if (((Component)__instance).gameObject.GetComponent<Player>().ai)
{
return true;
}
return !isFreeCam;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "freecam";
public const string PLUGIN_NAME = "freecam";
public const string PLUGIN_VERSION = "1.0.0";
}