Decompiled source of REPOSdk v1.0.0

REPOSDK.dll

Decompiled 2 weeks ago
using System.Collections.ObjectModel;
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("PatchLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PatchLib")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("594e4a0f-a50b-4351-bfac-075a97201798")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPOSdk;

[BepInPlugin("dev.chair.REPOsdk", "RepoSdk", "1.0.0.0")]
public class patch_lib_plug : BaseUnityPlugin
{
	public const string pluginGuid = "dev.chair.REPOsdk";

	public const string pluginName = "RepoSdk";

	public const string pluginVersion = "1.0.0.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.chair.REPOsdk");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello from REPOSdk!");
	}
}
public static class Sdk
{
	private static Collection<Camera> cameras = new Collection<Camera>();

	public static GameObject GetControllerObject()
	{
		return GameObject.Find("Controller");
	}

	public static PlayerController GetController()
	{
		return GetControllerObject().GetComponent<PlayerController>();
	}

	public static GameObject GetAvatarController()
	{
		return GetController().playerAvatar;
	}

	public static PlayerHealth GetHealthComponent()
	{
		return ((Component)GetAvatarController().transform).GetComponent<PlayerHealth>();
	}

	public static void Damage(int amount)
	{
		if ((Object)(object)GetAvatarController() != (Object)null)
		{
			GetHealthComponent().Hurt(amount, false, -1);
		}
		else
		{
			Debug.LogWarning((object)"Failed to take damage! Player not in game!");
		}
	}

	public static Camera GetGameCamera()
	{
		return GameObject.Find("Camera Main").GetComponent<Camera>();
	}

	public static void UnlockGameCamera()
	{
		((Behaviour)GameObject.Find("Position").GetComponent<CameraPosition>()).enabled = false;
		((Behaviour)GameObject.Find("Aim").GetComponent<CameraAim>()).enabled = false;
	}

	public static void FixGameCamera()
	{
		((Behaviour)GameObject.Find("Position").GetComponent<CameraPosition>()).enabled = true;
		((Behaviour)GameObject.Find("Aim").GetComponent<CameraAim>()).enabled = true;
	}

	public static void InitNewCamera(string name = "NewCamera", Transform parent = null)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		GameObject val = new GameObject(name);
		val.AddComponent<Camera>();
		if ((Object)(object)parent != (Object)null)
		{
			val.transform.parent = parent;
		}
		InsertCameraToList(val.GetComponent<Camera>());
	}

	public static void SetupCamera(Camera camera)
	{
		((Behaviour)camera).enabled = true;
		GetGameRenderObject().SetActive(false);
	}

	public static void ResetGameCamera()
	{
		GetGameRenderObject().SetActive(true);
		for (int i = 0; i < cameras.Count; i++)
		{
			((Behaviour)cameras[i]).enabled = false;
		}
	}

	public static GameObject GetHUD()
	{
		return GameObject.Find("HUD");
	}

	public static GameObject GetGameRenderObject()
	{
		return GameObject.Find("Canvas");
	}

	public static void InsertCameraToList(Camera camera)
	{
		if ((Object)(object)camera != (Object)null)
		{
			cameras.Add(camera);
		}
	}

	public static void RemoveCameraFromList(Camera camera)
	{
		if ((Object)(object)camera != (Object)null)
		{
			cameras.Remove(camera);
		}
	}
}