using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using CinematicToolsRevived;
using CinematicToolsRevived.Menu;
using HarmonyLib;
using Il2Cpp;
using Il2CppSLZ.Marrow;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering.Universal;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Spawn a camera, clone your avatar")]
[assembly: AssemblyDescription("Spawn a camera, clone your avatar")]
[assembly: AssemblyCompany("FragileDeviations")]
[assembly: AssemblyProduct("CinematicToolsRevived")]
[assembly: AssemblyCopyright("Developed by Mabel Amber, originally Krisp")]
[assembly: AssemblyTrademark("FragileDeviations")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: MelonInfo(typeof(Main), "CinematicToolsRevived", "1.0.1", "Mabel Amber, originally Krisp", "https://thunderstore.io/c/bonelab/p/SoulWithMae/CinematicToolsRevived/")]
[assembly: MelonColor(255, 255, 255, 255)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CinematicToolsRevived
{
public class Main : MelonMod
{
internal const string Name = "CinematicToolsRevived";
internal const string Description = "Spawn a camera, clone your avatar";
internal const string Author = "Mabel Amber, originally Krisp";
internal const string Company = "FragileDeviations";
internal const string Version = "1.0.1";
internal const string DownloadLink = "https://thunderstore.io/c/bonelab/p/SoulWithMae/CinematicToolsRevived/";
public override void OnInitializeMelon()
{
BoneMenu.Setup();
}
}
internal static class TheHandler
{
[HarmonyPatch(typeof(PlayerAvatarArt), "UpdateAvatarHead")]
private static class PlayerArtPatch
{
private static void Prefix(PlayerAvatarArt __instance)
{
if (_captureAvatar)
{
__instance.EnableHair();
CloneAvatar();
__instance.DisableHair();
_captureAvatar = false;
}
}
}
public static float AvatarCloneDelay = 1f;
private static Camera _cineCamera;
private static float _cineCamFoV = 90f;
private static GameObject _lastClonedAvatarRef;
private static readonly List<GameObject> ClonedAvatars = new List<GameObject>();
private static bool _captureAvatar;
public static void SpawnCamera()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0053: 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)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)_cineCamera))
{
Object.Destroy((Object)(object)((Component)_cineCamera).gameObject);
}
_cineCamera = null;
Transform transform = ((Component)Player.Head).transform;
GameObject val = new GameObject("CineTools_Camera");
if (Object.op_Implicit((Object)(object)val))
{
val.SetActive(false);
val.transform.position = ((Component)transform).transform.position;
val.transform.rotation = ((Component)transform).transform.rotation;
Camera val2 = (_cineCamera = val.AddComponent<Camera>());
val.AddComponent<UniversalAdditionalCameraData>().allowXRRendering = false;
val2.stereoTargetEye = (StereoTargetEyeMask)0;
val2.depth = 100f;
val2.depthTextureMode = (DepthTextureMode)1;
val2.depthTextureMode = (DepthTextureMode)4;
val2.fieldOfView = _cineCamFoV;
val2.farClipPlane = 10000f;
val2.nearClipPlane = 0.01f;
VolumetricRendering obj = val.AddComponent<VolumetricRendering>();
VolumetricData val3 = ScriptableObject.CreateInstance<VolumetricData>();
val3.near = 0.01f;
val3.far = 80f;
val3.FroxelWidthResolution = 24;
val3.FroxelHeightResolution = 24;
val3.FroxelDepthResolution = 12;
val3.ClipMapResolution = 64;
val3.ClipmapScale = 20f;
val3.ClipmapScale2 = 200f;
val3.ClipmapResampleThreshold = 3f;
obj.volumetricData = val3;
obj.reprojectionAmount = 0.95f;
obj.SliceDistributionUniformity = 0.5f;
obj.meanFreePath = 15f;
obj.StaticLightMultiplier = 1f;
obj.albedo = Color.white;
obj.tempOffset = 0f;
obj.FroxelBlur = (BlurType)0;
obj.cam = val2;
val.SetActive(true);
obj.CleanupOnReload();
}
}
public static void DestroyCamera()
{
if (Object.op_Implicit((Object)(object)_cineCamera))
{
Object.Destroy((Object)(object)((Component)_cineCamera).gameObject);
_cineCamera = null;
}
}
public static void UpdateCamera(float fov)
{
_cineCamFoV = fov;
if (Object.op_Implicit((Object)(object)_cineCamera))
{
_cineCamera.fieldOfView = _cineCamFoV;
}
}
public static void StartCloneAvatar()
{
MelonCoroutines.Start(CloneAvatarCoroutine());
}
private static IEnumerator CloneAvatarCoroutine()
{
yield return (object)new WaitForSeconds(AvatarCloneDelay);
_captureAvatar = true;
}
private static void CloneAvatar()
{
//IL_001e: 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)
GameObject gameObject = ((Component)Player.Avatar).gameObject;
GameObject val = Object.Instantiate<GameObject>(gameObject);
val.transform.position = gameObject.transform.position;
val.transform.rotation = gameObject.transform.rotation;
_lastClonedAvatarRef = val;
ClonedAvatars.Add(val);
}
public static void DestroyLastClone()
{
if (Object.op_Implicit((Object)(object)_lastClonedAvatarRef))
{
Object.Destroy((Object)(object)_lastClonedAvatarRef);
_lastClonedAvatarRef = null;
}
}
public static void DestroyAllClones()
{
foreach (GameObject clonedAvatar in ClonedAvatars)
{
Object.Destroy((Object)(object)clonedAvatar);
}
ClonedAvatars.Clear();
}
}
}
namespace CinematicToolsRevived.Menu
{
internal static class BoneMenu
{
private static bool _hairEnabled;
public static void Setup()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("Cinematic Tools", Color.yellow, 0, true);
obj.CreateFunction("Toggle Hair Mesh", Color.white, (Action)delegate
{
PlayerAvatarArt component = ((Component)Player.ControllerRig).GetComponent<PlayerAvatarArt>();
if (_hairEnabled)
{
component.DisableHair();
_hairEnabled = false;
}
else
{
component.EnableHair();
_hairEnabled = true;
}
});
Page val = obj.CreatePage("Custom Camera", Color.white, 0, true);
Page obj2 = obj.CreatePage("Clone Avatar", Color.white, 0, true);
val.CreateFloat("FOV", Color.white, 90f, 1f, 0f, 180f, (Action<float>)TheHandler.UpdateCamera);
val.CreateFunction("Spawn Camera", Color.green, (Action)TheHandler.SpawnCamera);
val.CreateFunction("Destroy Camera", Color.red, (Action)TheHandler.DestroyCamera);
obj2.CreateFloat("Capture Delay", Color.white, 1f, 1f, 0f, 999f, (Action<float>)delegate(float value)
{
TheHandler.AvatarCloneDelay = value;
});
obj2.CreateFunction("Dupe Avatar", Color.green, (Action)TheHandler.StartCloneAvatar);
obj2.CreateFunction("Delete Last Avatar", Color.yellow, (Action)TheHandler.DestroyLastClone);
obj2.CreateFunction("Delete All Avatars", Color.red, (Action)TheHandler.DestroyAllClones);
}
}
}