using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using RosayValuablesAPI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Rosay")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RosayValuablesAPI")]
[assembly: AssemblyTitle("RosayValuablesAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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;
}
}
}
public class AMCTrap : Trap
{
[Header("Sepia Filter Settings")]
public float sepiaIntensity = 1f;
private bool sepiaAppliedLocal = false;
public override void Start()
{
((Trap)this).Start();
}
public override void Update()
{
((Trap)this).Update();
if (base.physGrabObject.grabbed && !sepiaAppliedLocal && base.physGrabObject.grabbedLocal)
{
PostProcessing.Instance.SetSepiaOverride(sepiaIntensity, 9999f, ((Component)this).gameObject);
sepiaAppliedLocal = true;
}
if ((!base.physGrabObject.grabbed || !base.physGrabObject.grabbedLocal) && sepiaAppliedLocal)
{
PostProcessing.Instance.ClearSepiaOverride(((Component)this).gameObject);
sepiaAppliedLocal = false;
}
}
}
public class AsciiUIManager : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DelayedShow>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AsciiUIManager <>4__this;
private GameObject <container>5__1;
private RawImage <raw>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedShow>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<container>5__1 = null;
<raw>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<container>5__1 = GameObject.Find("UI/UI/Canvas/Render Texture Main");
if ((Object)(object)<container>5__1 == (Object)null)
{
Debug.LogError((object)"[AsciiUIManager] Render Texture Main not found.");
return false;
}
if ((Object)(object)<>4__this.uiInstance != (Object)null)
{
Debug.LogWarning((object)"[AsciiUIManager] Overlay already active.");
return false;
}
<>4__this.uiInstance = Object.Instantiate<GameObject>(<>4__this.asciiUIPrefab, <container>5__1.transform);
((Object)<>4__this.uiInstance).name = "Render Texture ASCII(Clone)";
<>4__this.uiInstance.transform.SetSiblingIndex(0);
<raw>5__2 = <>4__this.uiInstance.GetComponentInChildren<RawImage>();
if ((Object)(object)<raw>5__2 == (Object)null)
{
Debug.LogWarning((object)"[AsciiUIManager] UI prefab has no RawImage component.");
return false;
}
if ((Object)(object)RenderTextureMain.instance != (Object)null && (Object)(object)RenderTextureMain.instance.renderTexture != (Object)null)
{
<raw>5__2.texture = (Texture)(object)RenderTextureMain.instance.renderTexture;
Debug.Log((object)"[AsciiUIManager] Assigned RenderTextureMain.instance.renderTexture.");
}
else
{
Debug.LogWarning((object)"[AsciiUIManager] RenderTextureMain.instance or renderTexture is null!");
}
<>4__this.overlayShown = true;
Debug.Log((object)"[AsciiUIManager] Overlay shown.");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static AsciiUIManager current;
[Tooltip("Prefab for the ASCII UI to instantiate (must contain a RawImage)")]
public GameObject asciiUIPrefab;
private GameObject uiInstance;
private bool overlayShown = false;
private void Awake()
{
if ((Object)(object)current != (Object)null && (Object)(object)current != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
current = this;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
public void ShowOverlay()
{
if (overlayShown || (Object)(object)asciiUIPrefab == (Object)null)
{
Debug.LogWarning((object)"[AsciiUIManager] Overlay already shown or prefab missing.");
}
else
{
((MonoBehaviour)this).StartCoroutine(DelayedShow());
}
}
public void HideOverlay()
{
if ((Object)(object)uiInstance != (Object)null)
{
Object.Destroy((Object)(object)uiInstance);
uiInstance = null;
}
overlayShown = false;
Debug.Log((object)"[AsciiUIManager] Overlay hidden.");
}
[IteratorStateMachine(typeof(<DelayedShow>d__7))]
private IEnumerator DelayedShow()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedShow>d__7(0)
{
<>4__this = this
};
}
}
public class CATrap : Trap
{
private bool reverseActiveLocal = false;
public override void Start()
{
((Trap)this).Start();
}
public override void Update()
{
((Trap)this).Update();
if (base.physGrabObject.grabbed && !reverseActiveLocal && base.physGrabObject.grabbedLocal)
{
PlayerControllerReverseTranspiler.EnableReverseControls();
reverseActiveLocal = true;
}
if ((!base.physGrabObject.grabbed || !base.physGrabObject.grabbedLocal) && reverseActiveLocal)
{
PlayerControllerReverseTranspiler.DisableReverseControls();
reverseActiveLocal = false;
}
}
}
public class ChessKnightTrap : Trap
{
[Header("Hop Settings")]
public float hopUpForce = 6f;
public float hopForwardForce = 3f;
public float minHopCooldown = 0.25f;
[Header("Audio")]
[SerializeField]
public AudioSource? audioSource = null;
[SerializeField]
public AudioClip? hopSound = null;
[Header("Enemy Investigate")]
public float investigateRange = 7f;
private Rigidbody? rb = null;
private PhysGrabObjectImpactDetector? impactDetector = null;
private float lastHopTime = -999f;
public override void Start()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
((Trap)this).Start();
rb = ((Component)this).GetComponent<Rigidbody>();
impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).GetComponent<AudioSource>();
}
if ((Object)(object)impactDetector != (Object)null)
{
impactDetector.onAllImpacts.AddListener(new UnityAction(OnAnyImpact));
}
}
private void OnDestroy()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
if ((Object)(object)impactDetector != (Object)null)
{
impactDetector.onAllImpacts.RemoveListener(new UnityAction(OnAnyImpact));
}
}
private void OnAnyImpact()
{
if (!(Time.time - lastHopTime < minHopCooldown) && (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient()))
{
lastHopTime = Time.time;
if ((Object)(object)base.photonView != (Object)null)
{
base.photonView.RPC("RPCHop", (RpcTarget)0, Array.Empty<object>());
}
}
}
[PunRPC]
public void RPCHop()
{
Hop();
}
private void Hop()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rb == (Object)null))
{
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
rb.AddForce(Vector3.up * hopUpForce + ((Component)this).transform.forward * hopForwardForce, (ForceMode)1);
if ((Object)(object)audioSource != (Object)null && (Object)(object)hopSound != (Object)null)
{
audioSource.PlayOneShot(hopSound);
}
base.enemyInvestigate = true;
base.enemyInvestigateRange = investigateRange;
}
}
}
public class MirrorTrap : MonoBehaviour
{
[Header("Mirror Trap")]
public float lookThreshold = 5f;
public float rampTime = 3f;
public AudioSource? whisperSource;
public AudioClip? crackSound;
public float reverseDuration = 15f;
public Collider? mirrorCollider;
public float requiredDot = 0.97f;
public LayerMask raycastMask;
public float maxCheckDistance = 12f;
[Header("PostProcessing")]
public float vignetteIntensity = 0.5f;
public float vignetteSmoothness = 0.6f;
public Color vignetteColor = new Color(0.3f, 0.1f, 0.1f, 1f);
[Header("Camera Shake")]
public float maxShakeStrength = 1.5f;
public float shakeTime = 0.2f;
private float lookTimer = 0f;
private bool trapTriggered = false;
private bool reverseActive = false;
private float reverseTimer = 0f;
private Transform? playerCam = null;
private GameObject? vignetteObj = null;
private GameObject? saturationObj = null;
private bool fadingPostFX = false;
private float fadeOutTimer = 0f;
private float fadeOutDuration = 1.25f;
private void Start()
{
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)whisperSource != (Object)null)
{
whisperSource.volume = 0f;
if (!whisperSource.isPlaying)
{
whisperSource.Play();
}
}
if (((LayerMask)(ref raycastMask)).value == 0)
{
int num = LayerMask.NameToLayer("RoomVolume");
if (num != -1)
{
raycastMask = LayerMask.op_Implicit(~(1 << num));
}
else
{
raycastMask = LayerMask.op_Implicit(-1);
}
}
vignetteObj = new GameObject("MirrorTrapVignette_" + ((Object)this).GetInstanceID());
saturationObj = new GameObject("MirrorTrapSaturation_" + ((Object)this).GetInstanceID());
}
private void Update()
{
//IL_006b: 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_0074: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
//IL_0555: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar instance = PlayerAvatar.instance;
if ((Object)(object)instance == (Object)null || !instance.isLocal)
{
return;
}
playerCam = instance.localCameraTransform;
if ((Object)(object)playerCam == (Object)null)
{
return;
}
Vector3 val;
if (!((Object)(object)mirrorCollider != (Object)null))
{
val = ((Component)this).transform.position;
}
else
{
Bounds bounds = mirrorCollider.bounds;
val = ((Bounds)(ref bounds)).center;
}
Vector3 val2 = val;
Vector3 val3 = playerCam.position - val2;
float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
if (sqrMagnitude > maxCheckDistance * maxCheckDistance && !reverseActive)
{
FadeOutAllVisuals();
return;
}
bool flag = false;
val3 = val2 - playerCam.position;
Vector3 normalized = ((Vector3)(ref val3)).normalized;
float num = Vector3.Dot(playerCam.forward, normalized);
bool flag2 = false;
RaycastHit val4 = default(RaycastHit);
if ((Object)(object)mirrorCollider != (Object)null && Physics.Raycast(playerCam.position, playerCam.forward, ref val4, 20f, LayerMask.op_Implicit(raycastMask)) && (Object)(object)((RaycastHit)(ref val4)).collider == (Object)(object)mirrorCollider)
{
flag2 = true;
}
if (num > requiredDot && flag2)
{
flag = true;
}
float num2 = Mathf.Clamp01(lookTimer / rampTime);
if (flag && !trapTriggered)
{
lookTimer += Time.deltaTime;
num2 = Mathf.Clamp01(lookTimer / rampTime);
if ((Object)(object)whisperSource != (Object)null)
{
whisperSource.volume = num2;
}
if ((Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.CameraShake != (Object)null)
{
GameDirector.instance.CameraShake.Shake(maxShakeStrength * num2, shakeTime);
}
if ((Object)(object)PostProcessing.Instance != (Object)null)
{
PostProcessing.Instance.VignetteOverride(vignetteColor, Mathf.Lerp(0f, vignetteIntensity, num2), Mathf.Lerp(0.3f, vignetteSmoothness, num2), 2f, 2f, 0.2f, vignetteObj);
PostProcessing.Instance.SaturationOverride(Mathf.Lerp(0f, -100f, num2), 2f, 2f, 0.2f, saturationObj);
}
if (lookTimer >= lookThreshold)
{
trapTriggered = true;
if ((Object)(object)whisperSource != (Object)null)
{
whisperSource.volume = 0f;
whisperSource.Stop();
}
if ((Object)(object)crackSound != (Object)null && (Object)(object)playerCam != (Object)null)
{
AudioSource.PlayClipAtPoint(crackSound, playerCam.position);
}
PlayerControllerReverseTranspiler.EnableReverseControls();
reverseActive = true;
reverseTimer = reverseDuration;
}
}
else
{
lookTimer = Mathf.Max(lookTimer - Time.deltaTime * 2f, 0f);
num2 = Mathf.Clamp01(lookTimer / rampTime);
if ((Object)(object)whisperSource != (Object)null)
{
whisperSource.volume = num2;
}
if (!reverseActive && !fadingPostFX)
{
FadeOutAllVisuals(num2);
}
}
if (reverseActive)
{
reverseTimer -= Time.deltaTime;
if ((Object)(object)PostProcessing.Instance != (Object)null)
{
PostProcessing.Instance.VignetteOverride(vignetteColor, vignetteIntensity * 1.2f, vignetteSmoothness * 0.85f, 1f, 1f, 0.15f, vignetteObj);
PostProcessing.Instance.SaturationOverride(-100f, 1f, 1f, 0.15f, saturationObj);
}
if ((Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.CameraShake != (Object)null)
{
GameDirector.instance.CameraShake.Shake(0.12f, 0.1f);
}
if (reverseTimer <= 0f)
{
PlayerControllerReverseTranspiler.DisableReverseControls();
reverseActive = false;
trapTriggered = false;
fadingPostFX = true;
fadeOutTimer = 0f;
}
}
if (fadingPostFX)
{
fadeOutTimer += Time.deltaTime;
float num3 = Mathf.Clamp01(fadeOutTimer / fadeOutDuration);
float num4 = 1f - num3;
if ((Object)(object)PostProcessing.Instance != (Object)null)
{
PostProcessing.Instance.VignetteOverride(vignetteColor, Mathf.Lerp(0f, vignetteIntensity * 1.2f, num4), Mathf.Lerp(0.3f, vignetteSmoothness * 0.85f, num4), 2f, 2f, 0.2f, vignetteObj);
PostProcessing.Instance.SaturationOverride(Mathf.Lerp(0f, -100f, num4), 2f, 2f, 0.2f, saturationObj);
}
if (num3 >= 1f)
{
fadingPostFX = false;
FadeOutAllVisuals();
}
}
}
private void FadeOutAllVisuals(float ramp = 0f)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)PostProcessing.Instance != (Object)null)
{
PostProcessing.Instance.VignetteOverride(vignetteColor, Mathf.Lerp(0f, vignetteIntensity, ramp), Mathf.Lerp(0.3f, vignetteSmoothness, ramp), 2f, 2f, 0.2f, vignetteObj);
PostProcessing.Instance.SaturationOverride(Mathf.Lerp(0f, -100f, ramp), 2f, 2f, 0.2f, saturationObj);
}
}
private void OnDisable()
{
if (reverseActive)
{
PlayerControllerReverseTranspiler.DisableReverseControls();
reverseActive = false;
}
fadingPostFX = false;
fadeOutTimer = 0f;
FadeOutAllVisuals();
}
}
public class NoiseTrap : Trap
{
[Header("NoiseTrap Visuals")]
public ParticleSystem? trapParticles;
public AudioClip? loudSound;
public float soundVolume = 1f;
public float investigateRange = 50f;
[Header("Audio")]
public AudioSource? audioSource;
[Header("Camera Shake")]
public float shakeStrength = 2.5f;
public float shakeTime = 0.5f;
public float minShakeDistance = 4f;
public float maxShakeDistance = 12f;
[Header("Trap Effect Timing")]
public float particleDuration = 3f;
public float soundDuration = 3f;
private bool particlesActive = false;
private bool soundActive = false;
private float particleTimer = 0f;
private float soundTimer = 0f;
private bool shakeActive = false;
private bool effectActive = false;
private PhysGrabObject? physgrabObject;
private bool wasGrabbedLastFrame = false;
public override void Start()
{
((Trap)this).Start();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).GetComponent<AudioSource>();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.spatialBlend = 1f;
}
}
physgrabObject = ((Component)this).GetComponent<PhysGrabObject>();
}
public override void Update()
{
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
((Trap)this).Update();
bool flag = (Object)(object)physgrabObject != (Object)null && physgrabObject.grabbed;
if (!effectActive && !base.trapTriggered && flag)
{
((Trap)this).TrapActivateSync();
base.trapTriggered = true;
base.trapStart = true;
ActivateTrap();
effectActive = true;
}
if (base.trapTriggered && !flag && wasGrabbedLastFrame && !effectActive)
{
base.trapTriggered = false;
base.trapStart = false;
}
wasGrabbedLastFrame = flag;
if (particlesActive && (Object)(object)trapParticles != (Object)null)
{
particleTimer += Time.deltaTime;
if (particleTimer >= particleDuration)
{
trapParticles.Stop(true, (ParticleSystemStopBehavior)1);
particlesActive = false;
}
}
if (soundActive && (Object)(object)audioSource != (Object)null)
{
soundTimer += Time.deltaTime;
if (soundTimer >= soundDuration)
{
audioSource.Stop();
soundActive = false;
}
}
if (shakeActive)
{
if ((Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.CameraImpact != (Object)null)
{
GameDirector.instance.CameraImpact.ShakeDistance(shakeStrength, minShakeDistance, maxShakeDistance, ((Component)this).transform.position, 0.2f);
}
if (!particlesActive && !soundActive)
{
shakeActive = false;
}
}
if (effectActive && !particlesActive && !soundActive && !shakeActive && !flag)
{
effectActive = false;
base.trapTriggered = false;
base.trapStart = false;
}
}
public void ActivateTrap()
{
if ((Object)(object)trapParticles != (Object)null)
{
trapParticles.Play();
particlesActive = true;
particleTimer = 0f;
}
if ((Object)(object)loudSound != (Object)null && (Object)(object)audioSource != (Object)null)
{
audioSource.PlayOneShot(loudSound, soundVolume);
soundActive = true;
soundTimer = 0f;
}
shakeActive = true;
base.enemyInvestigate = true;
base.enemyInvestigateRange = investigateRange;
}
}
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/VHS Pro")]
public class postVHSPro : MonoBehaviour
{
private float time_ = 0f;
public Shader shader1 = null;
public Shader shader2 = null;
public Shader shader3 = null;
public Shader shader4 = null;
public Shader shader_clear = null;
public Shader shader_tape = null;
public Material mat1 = null;
public Material mat2 = null;
public Material mat3 = null;
public Material mat4 = null;
public Material mat_clear = null;
public Material mat_tape = null;
private RenderTexture texPass12 = null;
private RenderTexture texPass23 = null;
private RenderTexture texLast = null;
private RenderTexture texFeedback = null;
private RenderTexture texFeedback2 = null;
private RenderTexture texClear = null;
private RenderTexture texTape = null;
public bool g_showCRT = true;
public bool g_showNoise = true;
public bool g_showJitter = true;
public bool g_showSignal = true;
public bool g_showFeedback = true;
public bool g_showExtra = false;
public bool g_showBypass = false;
public bool bleedOn = true;
public int crtMode = 0;
public int crtLinesMode = 0;
public float screenLinesNum = 240f;
public float bleedAmount = 1f;
public bool bleedDebugOn = false;
public AnimationCurve bleedCurveY = AnimationCurve.Linear(0f, 1f, 1f, 0f);
public AnimationCurve bleedCurveI = AnimationCurve.Linear(0f, 0.5f, 1f, 0f);
public AnimationCurve bleedCurveQ = AnimationCurve.Linear(0f, 0.5f, 1f, 0f);
public int bleedLength = 21;
public bool bleedCurveEditModeOn = false;
public bool bleedCurveIQSyncOn = true;
private int max_curve_length = 50;
private Texture2D texCurves = null;
private Vector4 curvesOffest = new Vector4(0f, 0f, 0f, 0f);
private float[,] curvesData = new float[50, 3];
public bool fisheyeOn = true;
public float fisheyeBend = 2f;
public int fisheyeType = 0;
public float fisheyeSize = 1.2f;
public float cutoffX = 2f;
public float cutoffY = 3f;
public float cutoffFadeX = 25f;
public float cutoffFadeY = 25f;
public bool vignetteOn = false;
public float vignetteAmount = 1f;
public float vignetteSpeed = 1f;
public int noiseLinesMode = 1;
public float noiseLinesNum = 240f;
public float noiseQuantizeX = 0f;
public bool filmgrainOn = false;
public float filmGrainAmount = 0.016f;
public bool signalNoiseOn = true;
public float signalNoiseAmount = 0.15f;
public float signalNoisePower = 0.83f;
public bool tapeNoiseOn = true;
public float tapeNoiseTH = 0.63f;
public float tapeNoiseAmount = 1f;
public float tapeNoiseSpeed = 1f;
public bool lineNoiseOn = true;
public float lineNoiseAmount = 1f;
public float lineNoiseSpeed = 5f;
public bool scanLinesOn = false;
public float scanLineWidth = 10f;
public bool linesFloatOn = false;
public float linesFloatSpeed = 1f;
public bool stretchOn = true;
public bool twitchHOn = false;
public float twitchHFreq = 1f;
public bool twitchVOn = false;
public float twitchVFreq = 1f;
public bool jitterHOn = true;
public float jitterHAmount = 0.5f;
public bool jitterVOn = false;
public float jitterVAmount = 1f;
public float jitterVSpeed = 1f;
public bool signalTweakOn = false;
public float signalAdjustY = 0f;
public float signalAdjustI = 0f;
public float signalAdjustQ = 0f;
public float signalShiftY = 1f;
public float signalShiftI = 1f;
public float signalShiftQ = 1f;
public float gammaCorection = 1f;
public bool feedbackOn = false;
public int feedbackMode = 0;
public float feedbackThresh = 0.1f;
public float feedbackAmount = 2f;
public float feedbackFade = 0.82f;
public Color feedbackColor = new Color(1f, 0.5f, 0f);
public bool feedbackDebugOn = false;
public bool independentTimeOn = false;
public Texture bypassTex;
public Sprite spriteTex;
private void CreateMaterials()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
mat1 = new Material(shader1);
mat2 = new Material(shader2);
mat3 = new Material(shader3);
mat4 = new Material(shader4);
mat_clear = new Material(shader_clear);
mat_tape = new Material(shader_tape);
if (crtMode == 3)
{
buildCurves();
}
}
private void Awake()
{
if (crtMode == 3)
{
buildCurves();
}
}
private void Update()
{
}
private void CreateTextures(RenderTexture src)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Expected O, but got Unknown
Object.DestroyImmediate((Object)(object)texClear);
texClear = new RenderTexture(((Texture)src).width, ((Texture)src).height, src.depth);
((Texture)texClear).filterMode = (FilterMode)0;
texClear.Create();
Object.DestroyImmediate((Object)(object)texPass12);
texPass12 = new RenderTexture(((Texture)src).width, ((Texture)src).height, src.depth);
((Texture)texPass12).filterMode = (FilterMode)0;
texPass12.Create();
Object.DestroyImmediate((Object)(object)texPass23);
texPass23 = new RenderTexture(((Texture)src).width, ((Texture)src).height, src.depth);
((Texture)texPass23).filterMode = (FilterMode)0;
texPass23.Create();
Object.DestroyImmediate((Object)(object)texFeedback);
texFeedback = new RenderTexture(((Texture)src).width, ((Texture)src).height, 0);
((Object)texFeedback).hideFlags = (HideFlags)61;
((Texture)texFeedback).filterMode = (FilterMode)0;
texFeedback.Create();
Object.DestroyImmediate((Object)(object)texFeedback2);
texFeedback2 = new RenderTexture(((Texture)src).width, ((Texture)src).height, 0);
((Object)texFeedback2).hideFlags = (HideFlags)61;
((Texture)texFeedback2).filterMode = (FilterMode)0;
texFeedback2.Create();
Object.DestroyImmediate((Object)(object)texLast);
texLast = new RenderTexture(((Texture)src).width, ((Texture)src).height, 0);
((Object)texLast).hideFlags = (HideFlags)61;
((Texture)texLast).filterMode = (FilterMode)0;
texLast.Create();
Graphics.Blit((Texture)(object)texClear, texFeedback, mat_clear);
Graphics.Blit((Texture)(object)texClear, texFeedback2, mat_clear);
Graphics.Blit((Texture)(object)texClear, texLast, mat_clear);
}
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Expected O, but got Unknown
//IL_054f: Unknown result type (might be due to invalid IL or missing references)
//IL_0991: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)mat1 == (Object)null)
{
CreateMaterials();
}
if ((Object)(object)texPass12 == (Object)null || ((Texture)src).width != ((Texture)texPass12).width || ((Texture)src).height != ((Texture)texPass12).height)
{
CreateTextures(src);
}
float num = screenLinesNum;
if (num <= 0f)
{
num = ((Texture)src).height;
}
if ((tapeNoiseOn || filmgrainOn || lineNoiseOn) && ((Object)(object)texTape == (Object)null || (float)((Texture)texTape).height != Mathf.Min(noiseLinesNum, num)))
{
int num2 = (int)Mathf.Min(noiseLinesNum, num);
int num3 = (int)((float)num2 * (float)((Texture)src).width / (float)((Texture)src).height);
Object.DestroyImmediate((Object)(object)texTape);
texTape = new RenderTexture(num3, num2, 0);
((Object)texTape).hideFlags = (HideFlags)61;
((Texture)texTape).filterMode = (FilterMode)0;
texTape.Create();
Graphics.Blit((Texture)(object)texClear, texTape, mat_tape);
}
if (independentTimeOn)
{
time_ = Time.unscaledTime;
}
else
{
time_ = Time.time;
}
mat1.SetFloat("time_", time_);
mat1.SetFloat("screenLinesNum", num);
mat1.SetFloat("noiseLinesNum", noiseLinesNum);
mat1.SetFloat("noiseQuantizeX", noiseQuantizeX);
FeatureToggle(mat1, filmgrainOn, "VHS_FILMGRAIN_ON");
FeatureToggle(mat1, tapeNoiseOn, "VHS_TAPENOISE_ON");
FeatureToggle(mat1, lineNoiseOn, "VHS_LINENOISE_ON");
FeatureToggle(mat1, jitterHOn, "VHS_JITTER_H_ON");
mat1.SetFloat("jitterHAmount", jitterHAmount);
FeatureToggle(mat1, jitterVOn, "VHS_JITTER_V_ON");
mat1.SetFloat("jitterVAmount", jitterVAmount);
mat1.SetFloat("jitterVSpeed", jitterVSpeed);
FeatureToggle(mat1, linesFloatOn, "VHS_LINESFLOAT_ON");
mat1.SetFloat("linesFloatSpeed", linesFloatSpeed);
FeatureToggle(mat1, twitchHOn, "VHS_TWITCH_H_ON");
mat1.SetFloat("twitchHFreq", twitchHFreq);
FeatureToggle(mat1, twitchVOn, "VHS_TWITCH_V_ON");
mat1.SetFloat("twitchVFreq", twitchVFreq);
FeatureToggle(mat1, scanLinesOn, "VHS_SCANLINES_ON");
mat1.SetFloat("scanLineWidth", scanLineWidth);
FeatureToggle(mat1, signalNoiseOn, "VHS_YIQNOISE_ON");
mat1.SetFloat("signalNoisePower", signalNoisePower);
mat1.SetFloat("signalNoiseAmount", signalNoiseAmount);
FeatureToggle(mat1, stretchOn, "VHS_STRETCH_ON");
FeatureToggle(mat1, fisheyeOn, "VHS_FISHEYE_ON");
mat1.SetFloat("cutoffX", cutoffX);
mat1.SetFloat("cutoffY", cutoffY);
mat1.SetFloat("cutoffFadeX", cutoffFadeX);
mat1.SetFloat("cutoffFadeY", cutoffFadeY);
mat2.SetFloat("time_", time_);
mat2.SetFloat("screenLinesNum", num);
FeatureToggle(mat2, bleedOn, "VHS_BLEED_ON");
mat2.DisableKeyword("VHS_OLD_THREE_PHASE");
mat2.DisableKeyword("VHS_THREE_PHASE");
mat2.DisableKeyword("VHS_TWO_PHASE");
if (crtMode == 0)
{
mat2.EnableKeyword("VHS_OLD_THREE_PHASE");
}
else if (crtMode == 1)
{
mat2.EnableKeyword("VHS_THREE_PHASE");
}
else if (crtMode == 2)
{
mat2.EnableKeyword("VHS_TWO_PHASE");
}
else if (crtMode == 3 && bleedCurveEditModeOn)
{
buildCurves();
}
mat2.SetTexture("_CurvesTex", (Texture)(object)texCurves);
mat2.SetVector("curvesOffest", curvesOffest);
mat2.SetInt("bleedLength", bleedLength);
FeatureToggle(mat2, crtMode == 3, "VHS_CUSTOM_BLEED_ON");
FeatureToggle(mat2, bleedDebugOn, "VHS_DEBUG_BLEEDING_ON");
mat2.SetFloat("bleedAmount", bleedAmount);
FeatureToggle(mat2, fisheyeOn, "VHS_FISHEYE_ON");
FeatureToggle(mat2, fisheyeType == 1, "VHS_FISHEYE_HYPERSPACE");
mat2.SetFloat("fisheyeBend", fisheyeBend);
mat2.SetFloat("fisheyeSize", fisheyeSize);
FeatureToggle(mat2, vignetteOn, "VHS_VIGNETTE_ON");
mat2.SetFloat("vignetteAmount", vignetteAmount);
mat2.SetFloat("vignetteSpeed", vignetteSpeed);
FeatureToggle(mat2, signalTweakOn, "VHS_SIGNAL_TWEAK_ON");
mat2.SetFloat("signalAdjustY", signalAdjustY);
mat2.SetFloat("signalAdjustI", signalAdjustI);
mat2.SetFloat("signalAdjustQ", signalAdjustQ);
mat2.SetFloat("signalShiftY", signalShiftY);
mat2.SetFloat("signalShiftI", signalShiftI);
mat2.SetFloat("signalShiftQ", signalShiftQ);
mat2.SetFloat("gammaCorection", gammaCorection);
if (tapeNoiseOn || filmgrainOn || lineNoiseOn)
{
mat_tape.SetFloat("time_", time_);
FeatureToggle(mat_tape, filmgrainOn, "VHS_FILMGRAIN_ON");
mat_tape.SetFloat("filmGrainAmount", filmGrainAmount);
FeatureToggle(mat_tape, tapeNoiseOn, "VHS_TAPENOISE_ON");
mat_tape.SetFloat("tapeNoiseTH", tapeNoiseTH);
mat_tape.SetFloat("tapeNoiseAmount", tapeNoiseAmount);
mat_tape.SetFloat("tapeNoiseSpeed", tapeNoiseSpeed);
FeatureToggle(mat_tape, lineNoiseOn, "VHS_LINENOISE_ON");
mat_tape.SetFloat("lineNoiseAmount", lineNoiseAmount);
mat_tape.SetFloat("lineNoiseSpeed", lineNoiseSpeed);
Graphics.Blit((Texture)(object)texTape, texTape, mat_tape);
mat1.SetTexture("_TapeTex", (Texture)(object)texTape);
mat1.SetFloat("tapeNoiseAmount", tapeNoiseAmount);
}
if ((Object)(object)spriteTex != (Object)null)
{
bypassTex = (Texture)(object)spriteTex.texture;
}
if ((Object)(object)bypassTex != (Object)null)
{
Graphics.Blit(bypassTex, texPass12, mat1);
}
else
{
Graphics.Blit((Texture)(object)src, texPass12, mat1);
}
if (!feedbackOn)
{
Graphics.Blit((Texture)(object)texPass12, dest, mat2);
return;
}
Graphics.Blit((Texture)(object)texPass12, texPass23, mat2);
mat3.SetTexture("_LastTex", (Texture)(object)texLast);
mat3.SetTexture("_FeedbackTex", (Texture)(object)texFeedback);
mat3.SetFloat("feedbackThresh", feedbackThresh);
mat3.SetFloat("feedbackAmount", feedbackAmount);
mat3.SetFloat("feedbackFade", feedbackFade);
mat3.SetColor("feedbackColor", feedbackColor);
Graphics.Blit((Texture)(object)texPass23, texFeedback2, mat3);
Graphics.Blit((Texture)(object)texFeedback2, texFeedback);
mat4.SetFloat("feedbackAmp", 1f);
mat4.SetTexture("_FeedbackTex", (Texture)(object)texFeedback);
Graphics.Blit((Texture)(object)texPass23, texLast, mat4);
if (!feedbackDebugOn)
{
Graphics.Blit((Texture)(object)texLast, dest);
}
else
{
Graphics.Blit((Texture)(object)texFeedback, dest);
}
}
private void FeatureToggle(Material mat, bool propVal, string featureName)
{
if (propVal)
{
mat.EnableKeyword(featureName);
}
else
{
mat.DisableKeyword(featureName);
}
}
private void buildCurves()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)texCurves == (Object)null)
{
texCurves = new Texture2D(max_curve_length, 1, (TextureFormat)4, false);
}
((Vector4)(ref curvesOffest))[0] = 0f;
((Vector4)(ref curvesOffest))[1] = 0f;
((Vector4)(ref curvesOffest))[2] = 0f;
float num = 0f;
for (int i = 0; i < bleedLength; i++)
{
num = (float)i / (float)bleedLength;
curvesData[i, 0] = bleedCurveY.Evaluate(num);
curvesData[i, 1] = bleedCurveI.Evaluate(num);
curvesData[i, 2] = bleedCurveQ.Evaluate(num);
if (bleedCurveIQSyncOn)
{
curvesData[i, 2] = curvesData[i, 1];
}
if (((Vector4)(ref curvesOffest))[0] > curvesData[i, 0])
{
((Vector4)(ref curvesOffest))[0] = curvesData[i, 0];
}
if (((Vector4)(ref curvesOffest))[1] > curvesData[i, 1])
{
((Vector4)(ref curvesOffest))[1] = curvesData[i, 1];
}
if (((Vector4)(ref curvesOffest))[2] > curvesData[i, 2])
{
((Vector4)(ref curvesOffest))[2] = curvesData[i, 2];
}
}
((Vector4)(ref curvesOffest))[0] = Mathf.Abs(((Vector4)(ref curvesOffest))[0]);
((Vector4)(ref curvesOffest))[1] = Mathf.Abs(((Vector4)(ref curvesOffest))[1]);
((Vector4)(ref curvesOffest))[2] = Mathf.Abs(((Vector4)(ref curvesOffest))[2]);
for (int j = 0; j < bleedLength; j++)
{
curvesData[j, 0] += ((Vector4)(ref curvesOffest))[0];
curvesData[j, 1] += ((Vector4)(ref curvesOffest))[1];
curvesData[j, 2] += ((Vector4)(ref curvesOffest))[2];
texCurves.SetPixel(-2 + bleedLength - j, 0, new Color(curvesData[j, 0], curvesData[j, 1], curvesData[j, 2]));
}
texCurves.Apply();
}
}
[CreateAssetMenu(menuName = "Modding/ShaderReferenceHolder")]
public class ShaderReferenceHolder : ScriptableObject
{
public Material matVHSFirst;
public Material matVHSSecond;
public Material matVHSThird;
public Material matVHSForth;
public Material matVHSClear;
public Material matVHSTape;
}
public class UIOverlayPickupTrap : Trap
{
public GameObject asciiUIPrefab;
private bool overlayAppliedLocal = false;
public override void Start()
{
((Trap)this).Start();
}
public override void Update()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
((Trap)this).Update();
if (base.physGrabObject.grabbed && base.physGrabObject.grabbedLocal && !overlayAppliedLocal)
{
if ((Object)(object)AsciiUIManager.current == (Object)null)
{
GameObject val = new GameObject("AsciiUIManager");
AsciiUIManager asciiUIManager = val.AddComponent<AsciiUIManager>();
asciiUIManager.asciiUIPrefab = asciiUIPrefab;
if ((Object)(object)asciiUIManager.asciiUIPrefab == (Object)null)
{
Debug.LogError((object)"[Trap] ASCII prefab was not assigned in the inspector.");
return;
}
Debug.Log((object)"[Trap] AsciiUIManager created at runtime.");
}
AsciiUIManager.current?.ShowOverlay();
overlayAppliedLocal = true;
}
if ((!base.physGrabObject.grabbed || !base.physGrabObject.grabbedLocal) && overlayAppliedLocal)
{
AsciiUIManager.current?.HideOverlay();
overlayAppliedLocal = false;
}
}
}
public class VHSProTrap : Trap
{
[Header("VHS Pro Shader References")]
[Tooltip("Shader for 1st pass (postVHSPro_First)")]
public Shader shader1;
[Tooltip("Shader for 2nd pass (postVHSPro_Second)")]
public Shader shader2;
[Tooltip("Shader for 3rd pass (postVHSPro_Third)")]
public Shader shader3;
[Tooltip("Shader for 4th pass (postVHSPro_Fourth)")]
public Shader shader4;
[Tooltip("Shader for clearing textures (postVHSPro_Clear)")]
public Shader shader_clear;
[Tooltip("Shader for tape noise (postVHSPro_Tape)")]
public Shader shader_tape;
[Header("CRT")]
[Tooltip("Enable color bleed effect")]
public bool bleedOn = true;
[Tooltip("CRT emulation mode (0=Old Three Phase, 1=Three Phase, 2=Two Phase, 3=Custom Curve)")]
[Range(0f, 3f)]
public int crtMode = 0;
[Tooltip("CRT lines mode (not always used)")]
public int crtLinesMode = 0;
[Tooltip("Number of screen lines (vertical resolution emulation)")]
[Range(1f, 1000f)]
public float screenLinesNum = 240f;
[Tooltip("Amount of color bleed")]
[Range(0f, 10f)]
public float bleedAmount = 1f;
[Tooltip("Debug the color bleed effect")]
public bool bleedDebugOn = false;
[Tooltip("Bleed curve for Y channel (custom mode only)")]
public AnimationCurve bleedCurveY = AnimationCurve.Linear(0f, 1f, 1f, 0f);
[Tooltip("Bleed curve for I channel (custom mode only)")]
public AnimationCurve bleedCurveI = AnimationCurve.Linear(0f, 0.5f, 1f, 0f);
[Tooltip("Bleed curve for Q channel (custom mode only)")]
public AnimationCurve bleedCurveQ = AnimationCurve.Linear(0f, 0.5f, 1f, 0f);
[Tooltip("Bleed curve length (custom mode only)")]
public int bleedLength = 21;
[Tooltip("Enable editing the custom bleed curve in-game")]
public bool bleedCurveEditModeOn = false;
[Tooltip("Sync Q curve to I curve (custom mode only)")]
public bool bleedCurveIQSyncOn = true;
[Header("Fisheye")]
[Tooltip("Enable fisheye lens distortion")]
public bool fisheyeOn = true;
[Tooltip("Fisheye bend strength")]
[Range(0f, 10f)]
public float fisheyeBend = 2f;
[Tooltip("Fisheye type (0=default, 1=hyperspace)")]
public int fisheyeType = 0;
[Tooltip("Fisheye size")]
[Range(0f, 10f)]
public float fisheyeSize = 1.2f;
[Tooltip("Cutoff horizontal position")]
public float cutoffX = 2f;
[Tooltip("Cutoff vertical position")]
public float cutoffY = 3f;
[Tooltip("Fade distance to horizontal cutoff")]
public float cutoffFadeX = 25f;
[Tooltip("Fade distance to vertical cutoff")]
public float cutoffFadeY = 25f;
[Header("Vignette")]
[Tooltip("Enable vignette (darkening at edges)")]
public bool vignetteOn = false;
[Tooltip("Vignette strength")]
[Range(0f, 5f)]
public float vignetteAmount = 1f;
[Tooltip("Vignette speed (for animated vignette)")]
[Range(0f, 5f)]
public float vignetteSpeed = 1f;
[Header("Noise")]
[Tooltip("Noise lines mode (quantization algorithm)")]
public int noiseLinesMode = 1;
[Tooltip("Number of lines for noise quantization")]
public float noiseLinesNum = 240f;
[Tooltip("Horizontal noise quantization")]
public float noiseQuantizeX = 0f;
[Tooltip("Enable film grain effect")]
public bool filmgrainOn = false;
[Tooltip("Film grain intensity")]
[Range(0f, 0.1f)]
public float filmGrainAmount = 0.016f;
[Tooltip("Enable signal noise")]
public bool signalNoiseOn = true;
[Tooltip("Signal noise intensity")]
[Range(0f, 1f)]
public float signalNoiseAmount = 0.15f;
[Tooltip("Signal noise power (color shift/strength)")]
[Range(0f, 1f)]
public float signalNoisePower = 0.83f;
[Tooltip("Enable tape noise")]
public bool tapeNoiseOn = true;
[Tooltip("Tape noise threshold (for flicker)")]
public float tapeNoiseTH = 0.63f;
[Tooltip("Tape noise intensity")]
[Range(0f, 2f)]
public float tapeNoiseAmount = 1f;
[Tooltip("Tape noise speed")]
[Range(0f, 2f)]
public float tapeNoiseSpeed = 1f;
[Tooltip("Enable line noise")]
public bool lineNoiseOn = true;
[Tooltip("Line noise intensity")]
[Range(0f, 10f)]
public float lineNoiseAmount = 1f;
[Tooltip("Line noise speed")]
[Range(0f, 10f)]
public float lineNoiseSpeed = 5f;
[Header("Jitter & Glitch")]
[Tooltip("Enable scan lines")]
public bool scanLinesOn = false;
[Tooltip("Scan line width (thickness)")]
public float scanLineWidth = 10f;
[Tooltip("Enable floating lines")]
public bool linesFloatOn = false;
[Tooltip("Speed of floating lines")]
public float linesFloatSpeed = 1f;
[Tooltip("Enable horizontal stretch effect")]
public bool stretchOn = true;
[Tooltip("Enable horizontal twitch")]
public bool twitchHOn = false;
[Tooltip("Horizontal twitch frequency")]
public float twitchHFreq = 1f;
[Tooltip("Enable vertical twitch")]
public bool twitchVOn = false;
[Tooltip("Vertical twitch frequency")]
public float twitchVFreq = 1f;
[Tooltip("Enable horizontal jitter")]
public bool jitterHOn = true;
[Tooltip("Horizontal jitter amount")]
public float jitterHAmount = 0.5f;
[Tooltip("Enable vertical jitter")]
public bool jitterVOn = false;
[Tooltip("Vertical jitter amount")]
public float jitterVAmount = 1f;
[Tooltip("Vertical jitter speed")]
public float jitterVSpeed = 1f;
[Header("Signal Tweak")]
[Tooltip("Enable signal tweak")]
public bool signalTweakOn = false;
[Tooltip("Luma adjust (Y channel)")]
public float signalAdjustY = 0f;
[Tooltip("Chrominance adjust (I channel)")]
public float signalAdjustI = 0f;
[Tooltip("Chrominance adjust (Q channel)")]
public float signalAdjustQ = 0f;
[Tooltip("Luma shift (Y channel)")]
public float signalShiftY = 1f;
[Tooltip("Chrominance shift (I channel)")]
public float signalShiftI = 1f;
[Tooltip("Chrominance shift (Q channel)")]
public float signalShiftQ = 1f;
[Tooltip("Final gamma correction")]
public float gammaCorection = 1f;
[Header("Feedback / Trails")]
[Tooltip("Enable feedback trails")]
public bool feedbackOn = false;
[Tooltip("Feedback mode (advanced)")]
public int feedbackMode = 0;
[Tooltip("Feedback threshold (sensitivity)")]
[Range(0f, 1f)]
public float feedbackThresh = 0.1f;
[Tooltip("Feedback amount (trail strength)")]
[Range(0f, 3f)]
public float feedbackAmount = 2f;
[Tooltip("Feedback fade (how quickly trail fades)")]
[Range(0f, 1f)]
public float feedbackFade = 0.82f;
[Tooltip("Feedback color")]
public Color feedbackColor = new Color(1f, 0.5f, 0f);
[Tooltip("Enable feedback debug mode")]
public bool feedbackDebugOn = false;
[Header("Extra / Tools")]
[Tooltip("Use unscaled time (ignore time scale/slow-mo)")]
public bool independentTimeOn = false;
private bool vhsProAppliedLocal = false;
private postVHSPro cachedVHSPro;
public override void Update()
{
((Trap)this).Update();
if (base.physGrabObject.grabbed && !vhsProAppliedLocal && base.physGrabObject.grabbedLocal)
{
ApplyVHSProEffect();
vhsProAppliedLocal = true;
}
if ((!base.physGrabObject.grabbed || !base.physGrabObject.grabbedLocal) && vhsProAppliedLocal)
{
RemoveVHSProEffect();
vhsProAppliedLocal = false;
}
}
private Camera FindLocalPlayerCameraTop()
{
if (Object.op_Implicit((Object)(object)PlayerAvatar.instance))
{
Transform[] componentsInChildren = ((Component)PlayerAvatar.instance).GetComponentsInChildren<Transform>(true);
Transform[] array = componentsInChildren;
foreach (Transform val in array)
{
if (((Object)val).name == "Camera Top")
{
Camera component = ((Component)val).GetComponent<Camera>();
if (Object.op_Implicit((Object)(object)component))
{
return component;
}
}
}
}
Camera[] array2 = Object.FindObjectsOfType<Camera>();
foreach (Camera val2 in array2)
{
if (((Object)val2).name == "Camera Top")
{
return val2;
}
}
return null;
}
private void ApplyVHSProEffect()
{
//IL_0567: Unknown result type (might be due to invalid IL or missing references)
//IL_056c: Unknown result type (might be due to invalid IL or missing references)
Camera val = FindLocalPlayerCameraTop();
if (Object.op_Implicit((Object)(object)val))
{
cachedVHSPro = ((Component)val).GetComponent<postVHSPro>();
if (!Object.op_Implicit((Object)(object)cachedVHSPro))
{
cachedVHSPro = ((Component)val).gameObject.AddComponent<postVHSPro>();
}
if (Object.op_Implicit((Object)(object)shader1))
{
cachedVHSPro.shader1 = shader1;
}
if (Object.op_Implicit((Object)(object)shader2))
{
cachedVHSPro.shader2 = shader2;
}
if (Object.op_Implicit((Object)(object)shader3))
{
cachedVHSPro.shader3 = shader3;
}
if (Object.op_Implicit((Object)(object)shader4))
{
cachedVHSPro.shader4 = shader4;
}
if (Object.op_Implicit((Object)(object)shader_clear))
{
cachedVHSPro.shader_clear = shader_clear;
}
if (Object.op_Implicit((Object)(object)shader_tape))
{
cachedVHSPro.shader_tape = shader_tape;
}
cachedVHSPro.bleedOn = bleedOn;
cachedVHSPro.crtMode = crtMode;
cachedVHSPro.crtLinesMode = crtLinesMode;
cachedVHSPro.screenLinesNum = screenLinesNum;
cachedVHSPro.bleedAmount = bleedAmount;
cachedVHSPro.bleedDebugOn = bleedDebugOn;
cachedVHSPro.bleedCurveY = bleedCurveY;
cachedVHSPro.bleedCurveI = bleedCurveI;
cachedVHSPro.bleedCurveQ = bleedCurveQ;
cachedVHSPro.bleedLength = bleedLength;
cachedVHSPro.bleedCurveEditModeOn = bleedCurveEditModeOn;
cachedVHSPro.bleedCurveIQSyncOn = bleedCurveIQSyncOn;
cachedVHSPro.fisheyeOn = fisheyeOn;
cachedVHSPro.fisheyeBend = fisheyeBend;
cachedVHSPro.fisheyeType = fisheyeType;
cachedVHSPro.fisheyeSize = fisheyeSize;
cachedVHSPro.cutoffX = cutoffX;
cachedVHSPro.cutoffY = cutoffY;
cachedVHSPro.cutoffFadeX = cutoffFadeX;
cachedVHSPro.cutoffFadeY = cutoffFadeY;
cachedVHSPro.vignetteOn = vignetteOn;
cachedVHSPro.vignetteAmount = vignetteAmount;
cachedVHSPro.vignetteSpeed = vignetteSpeed;
cachedVHSPro.noiseLinesMode = noiseLinesMode;
cachedVHSPro.noiseLinesNum = noiseLinesNum;
cachedVHSPro.noiseQuantizeX = noiseQuantizeX;
cachedVHSPro.filmgrainOn = filmgrainOn;
cachedVHSPro.filmGrainAmount = filmGrainAmount;
cachedVHSPro.signalNoiseOn = signalNoiseOn;
cachedVHSPro.signalNoiseAmount = signalNoiseAmount;
cachedVHSPro.signalNoisePower = signalNoisePower;
cachedVHSPro.tapeNoiseOn = tapeNoiseOn;
cachedVHSPro.tapeNoiseTH = tapeNoiseTH;
cachedVHSPro.tapeNoiseAmount = tapeNoiseAmount;
cachedVHSPro.tapeNoiseSpeed = tapeNoiseSpeed;
cachedVHSPro.lineNoiseOn = lineNoiseOn;
cachedVHSPro.lineNoiseAmount = lineNoiseAmount;
cachedVHSPro.lineNoiseSpeed = lineNoiseSpeed;
cachedVHSPro.scanLinesOn = scanLinesOn;
cachedVHSPro.scanLineWidth = scanLineWidth;
cachedVHSPro.linesFloatOn = linesFloatOn;
cachedVHSPro.linesFloatSpeed = linesFloatSpeed;
cachedVHSPro.stretchOn = stretchOn;
cachedVHSPro.twitchHOn = twitchHOn;
cachedVHSPro.twitchHFreq = twitchHFreq;
cachedVHSPro.twitchVOn = twitchVOn;
cachedVHSPro.twitchVFreq = twitchVFreq;
cachedVHSPro.jitterHOn = jitterHOn;
cachedVHSPro.jitterHAmount = jitterHAmount;
cachedVHSPro.jitterVOn = jitterVOn;
cachedVHSPro.jitterVAmount = jitterVAmount;
cachedVHSPro.jitterVSpeed = jitterVSpeed;
cachedVHSPro.signalTweakOn = signalTweakOn;
cachedVHSPro.signalAdjustY = signalAdjustY;
cachedVHSPro.signalAdjustI = signalAdjustI;
cachedVHSPro.signalAdjustQ = signalAdjustQ;
cachedVHSPro.signalShiftY = signalShiftY;
cachedVHSPro.signalShiftI = signalShiftI;
cachedVHSPro.signalShiftQ = signalShiftQ;
cachedVHSPro.gammaCorection = gammaCorection;
cachedVHSPro.feedbackOn = feedbackOn;
cachedVHSPro.feedbackMode = feedbackMode;
cachedVHSPro.feedbackThresh = feedbackThresh;
cachedVHSPro.feedbackAmount = feedbackAmount;
cachedVHSPro.feedbackFade = feedbackFade;
cachedVHSPro.feedbackColor = feedbackColor;
cachedVHSPro.feedbackDebugOn = feedbackDebugOn;
cachedVHSPro.independentTimeOn = independentTimeOn;
((Behaviour)cachedVHSPro).enabled = true;
}
else
{
Debug.LogWarning((object)"VHSProTrap: No 'Camera Top' camera found on local player!");
}
}
private void RemoveVHSProEffect()
{
Camera val = FindLocalPlayerCameraTop();
if (!Object.op_Implicit((Object)(object)cachedVHSPro) && Object.op_Implicit((Object)(object)val))
{
cachedVHSPro = ((Component)val).GetComponent<postVHSPro>();
}
if (Object.op_Implicit((Object)(object)cachedVHSPro))
{
((Behaviour)cachedVHSPro).enabled = false;
}
}
}
public class WhoopeeCushionTrap : Trap
{
[Header("Audio")]
[SerializeField]
public AudioSource? audioSource = null;
[SerializeField]
public AudioSource? fartAudioSource = null;
[SerializeField]
public AudioClip? fartSound = null;
[SerializeField]
public AudioClip? explosionSound = null;
[Header("Explosion Settings")]
public float explodeChance = 0.1f;
public float explosionSize = 0.35f;
public int explosionDamage = 120;
public int explosionEnemyDamage = 200;
public float explosionForceMulti = 1.2f;
[Header("Enemy Investigate")]
public float investigateRangeNormal = 15f;
public float investigateRangeExplosion = 60f;
private Rigidbody? rb = null;
private PhysGrabObjectImpactDetector? impactDetector = null;
private ParticleScriptExplosion? particleScriptExplosion = null;
private float lastFartTime = -999f;
public float fartCooldown = 0.2f;
private bool hasExploded = false;
public override void Start()
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
((Trap)this).Start();
rb = ((Component)this).GetComponent<Rigidbody>();
impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).GetComponent<AudioSource>();
}
if ((Object)(object)fartAudioSource == (Object)null && (Object)(object)((Component)this).transform.Find("FartAudioSource") != (Object)null)
{
fartAudioSource = ((Component)((Component)this).transform.Find("FartAudioSource")).GetComponent<AudioSource>();
}
if ((Object)(object)impactDetector != (Object)null)
{
impactDetector.onImpactMedium.RemoveListener(new UnityAction(OnMediumImpact));
impactDetector.onImpactHeavy.RemoveListener(new UnityAction(OnHeavyImpact));
impactDetector.onImpactMedium.AddListener(new UnityAction(OnMediumImpact));
impactDetector.onImpactHeavy.AddListener(new UnityAction(OnHeavyImpact));
}
}
private void OnDestroy()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
if ((Object)(object)impactDetector != (Object)null)
{
impactDetector.onImpactMedium.RemoveListener(new UnityAction(OnMediumImpact));
impactDetector.onImpactHeavy.RemoveListener(new UnityAction(OnHeavyImpact));
}
}
private void OnMediumImpact()
{
TryActivateTrap("Medium");
}
private void OnHeavyImpact()
{
TryActivateTrap("Heavy");
}
private void TryActivateTrap(string impactType = "Any")
{
if (!hasExploded && !(Time.time - lastFartTime < fartCooldown) && (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient()))
{
lastFartTime = Time.time;
if ((Object)(object)base.photonView != (Object)null)
{
base.photonView.RPC("RPCFartAndMaybeExplode", (RpcTarget)0, new object[1] { impactType });
}
}
}
public void TryTriggerByCollider()
{
if (!hasExploded && !(Time.time - lastFartTime < fartCooldown) && (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient()))
{
lastFartTime = Time.time;
if ((Object)(object)base.photonView != (Object)null)
{
base.photonView.RPC("RPCFartAndMaybeExplode", (RpcTarget)0, new object[1] { "Trigger" });
}
}
}
[PunRPC]
public void RPCFartAndMaybeExplode(string triggerType)
{
if (!hasExploded)
{
if ((Object)(object)fartAudioSource != (Object)null && (Object)(object)fartSound != (Object)null)
{
fartAudioSource.maxDistance = investigateRangeNormal;
fartAudioSource.PlayOneShot(fartSound);
}
else if ((Object)(object)audioSource != (Object)null && (Object)(object)fartSound != (Object)null)
{
audioSource.maxDistance = investigateRangeNormal;
audioSource.PlayOneShot(fartSound);
}
if (Random.value < explodeChance)
{
hasExploded = true;
Explode();
}
else
{
base.enemyInvestigate = true;
base.enemyInvestigateRange = investigateRangeNormal;
}
}
}
private void Explode()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)audioSource != (Object)null && (Object)(object)explosionSound != (Object)null)
{
audioSource.maxDistance = investigateRangeExplosion;
audioSource.PlayOneShot(explosionSound);
}
if ((Object)(object)particleScriptExplosion != (Object)null)
{
Vector3 position = ((Component)this).transform.position;
particleScriptExplosion.Spawn(position, explosionSize, explosionDamage, explosionEnemyDamage, explosionForceMulti, false, false, 1f);
}
base.enemyInvestigate = true;
base.enemyInvestigateRange = investigateRangeExplosion;
if ((Object)(object)base.physGrabObject != (Object)null)
{
base.physGrabObject.dead = true;
}
}
}
public class WhoopeeCushionTrigger : MonoBehaviour
{
private WhoopeeCushionTrap? trap;
private void Start()
{
trap = ((Component)this).GetComponentInParent<WhoopeeCushionTrap>();
}
private void OnTriggerEnter(Collider other)
{
PlayerController componentInParent = ((Component)other).GetComponentInParent<PlayerController>();
PlayerAvatar componentInParent2 = ((Component)other).GetComponentInParent<PlayerAvatar>();
PhysGrabObject componentInParent3 = ((Component)other).GetComponentInParent<PhysGrabObject>();
bool flag = (Object)(object)componentInParent3 != (Object)null && componentInParent3.isEnemy;
if ((Object)(object)componentInParent != (Object)null || (Object)(object)componentInParent2 != (Object)null || flag)
{
trap?.TryTriggerByCollider();
}
}
}
public class ZenithBlackHole : MonoBehaviourPun
{
public SemiLaser semiLaser;
public float pullRadius = 8f;
public float pullStrength = 32f;
public LayerMask pullLayerMask;
public List<PhysGrabObject> ignoreObjects = new List<PhysGrabObject>();
[Header("Pull Force Falloff")]
public AnimationCurve pullFalloffCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0.3f);
[Header("Player Pull Settings")]
[Tooltip("How much to scale the pull force for players (e.g., 0.5 = half strength)")]
public float playerPullMultiplier = 0.5f;
private void Start()
{
if ((Object)(object)semiLaser == (Object)null)
{
semiLaser = ((Component)this).GetComponentInParent<SemiLaser>();
}
}
private void FixedUpdate()
{
//IL_006b: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)semiLaser == (Object)null || (Object)(object)semiLaser.hitTransform == (Object)null || !((Component)semiLaser.hitTransform).gameObject.activeSelf || !SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
Vector3 position = semiLaser.hitTransform.position;
Collider[] array = Physics.OverlapSphere(position, pullRadius, LayerMask.op_Implicit(pullLayerMask));
Collider[] array2 = array;
foreach (Collider val in array2)
{
Rigidbody attachedRigidbody = val.attachedRigidbody;
if (!((Object)(object)attachedRigidbody != (Object)null))
{
continue;
}
PhysGrabObject component = ((Component)attachedRigidbody).GetComponent<PhysGrabObject>();
if ((Object)(object)component != (Object)null && ignoreObjects.Contains(component))
{
continue;
}
float num = Vector3.Distance(position, attachedRigidbody.position);
if (!(num < 0.2f))
{
float num2 = Mathf.Clamp01(num / pullRadius);
float num3 = pullFalloffCurve.Evaluate(num2);
float num4 = pullStrength * num3;
if (((Component)val).CompareTag("Player") || (Object)(object)((Component)val).GetComponentInParent<PlayerAvatar>() != (Object)null)
{
num4 *= playerPullMultiplier;
}
Vector3 val2 = position - attachedRigidbody.position;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
attachedRigidbody.AddForce(normalized * num4, (ForceMode)5);
}
}
}
private void OnDrawGizmosSelected()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)semiLaser != (Object)null && (Object)(object)semiLaser.hitTransform != (Object)null)
{
Gizmos.color = Color.cyan;
Gizmos.DrawWireSphere(semiLaser.hitTransform.position, pullRadius);
}
}
}
namespace RosayValuablesAPI
{
[HarmonyPatch(typeof(PlayerController), "FixedUpdate")]
public static class PlayerControllerReverseTranspiler
{
public static bool reverseMovementActive;
public static void EnableReverseControls()
{
reverseMovementActive = true;
}
public static void DisableReverseControls()
{
reverseMovementActive = false;
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerController), "InputDirection");
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Stfld && fieldInfo.Equals(list[i].operand))
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
list.Insert(i + 2, CodeInstruction.Call(typeof(PlayerControllerReverseTranspiler), "MaybeReverseInputDirection", (Type[])null, (Type[])null));
i += 2;
}
}
return list;
}
public static void MaybeReverseInputDirection(PlayerController player)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (reverseMovementActive && (Object)(object)player == (Object)(object)PlayerController.instance)
{
player.InputDirection = -player.InputDirection;
}
}
}
[HarmonyPatch]
public static class PostProcessingSepiaPatch
{
private static bool sepiaOverrideActive = false;
private static float sepiaOverrideLerp = 0f;
private static float sepiaOverrideTimer = 0f;
private static float sepiaOverrideSpeedIn;
private static float sepiaOverrideSpeedOut;
private static Color sepiaOverrideColor = new Color(0.44f, 0.36f, 0.18f);
private static float sepiaOverrideIntensity = 1f;
private static GameObject? sepiaOverrideObject = null;
private static Color colorFilterOriginal;
private static ColorGrading? colorGrading => ((Object)(object)PostProcessing.Instance != (Object)null) ? PostProcessing.Instance.colorGrading : null;
[HarmonyPatch(typeof(PostProcessing), "Update")]
[HarmonyPostfix]
public static void PostProcessing_Update_Postfix(PostProcessing __instance)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_0054: 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_00d7: 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)
if (!sepiaOverrideActive || !((Object)(object)colorGrading != (Object)null))
{
return;
}
Color value = Color.Lerp(colorFilterOriginal, sepiaOverrideColor, sepiaOverrideLerp * sepiaOverrideIntensity);
if (sepiaOverrideTimer > 0f)
{
((ParameterOverride<Color>)(object)colorGrading.colorFilter).value = value;
sepiaOverrideLerp += sepiaOverrideSpeedIn * Time.deltaTime;
sepiaOverrideLerp = Mathf.Clamp01(sepiaOverrideLerp);
sepiaOverrideTimer -= Time.deltaTime;
return;
}
((ParameterOverride<Color>)(object)colorGrading.colorFilter).value = value;
sepiaOverrideLerp -= sepiaOverrideSpeedOut * Time.deltaTime;
if (sepiaOverrideLerp <= 0f)
{
((ParameterOverride<Color>)(object)colorGrading.colorFilter).value = colorFilterOriginal;
sepiaOverrideActive = false;
sepiaOverrideLerp = 0f;
}
}
public static void SetSepiaOverride(float intensity, float duration, GameObject obj)
{
//IL_0036: 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)
if (!((Object)(object)colorGrading == (Object)null))
{
if (!sepiaOverrideActive || (Object)(object)obj != (Object)(object)sepiaOverrideObject)
{
colorFilterOriginal = ((ParameterOverride<Color>)(object)colorGrading.colorFilter).value;
sepiaOverrideLerp = 0f;
}
sepiaOverrideActive = true;
sepiaOverrideObject = obj;
sepiaOverrideTimer = duration;
sepiaOverrideSpeedIn = 4f;
sepiaOverrideSpeedOut = 2f;
sepiaOverrideIntensity = Mathf.Clamp01(intensity);
}
}
public static void ClearSepiaOverride(GameObject obj)
{
if (sepiaOverrideActive && (Object)(object)sepiaOverrideObject == (Object)(object)obj)
{
sepiaOverrideTimer = 0f;
}
}
}
public static class PostProcessingExtensions
{
public static void SetSepiaOverride(this PostProcessing _, float intensity, float duration, GameObject obj)
{
PostProcessingSepiaPatch.SetSepiaOverride(intensity, duration, obj);
}
public static void ClearSepiaOverride(this PostProcessing _, GameObject obj)
{
PostProcessingSepiaPatch.ClearSepiaOverride(obj);
}
}
[BepInPlugin("Rosay.RosayValuablesAPI", "RosayValuablesAPI", "1.0")]
public class RosayValuablesAPI : BaseUnityPlugin
{
internal static RosayValuablesAPI Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: 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_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}