using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[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("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Kitty")]
[assembly: AssemblyTitle("Kitty")]
[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 ValuableCat : Trap
{
private class GhostFlyer : MonoBehaviour
{
private Vector3 _vel;
private float _life;
private float _t;
private MeshRenderer _mr;
private MaterialPropertyBlock _mpb;
private Color _base;
private bool _useEmission;
private float _emissionMax;
public void Init(Vector3 velocity, float life, Color baseColor, bool useEmission, float emissionMax)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_003d: Expected O, but got Unknown
_vel = velocity;
_life = life;
_base = baseColor;
_useEmission = useEmission;
_emissionMax = emissionMax;
_mr = ((Component)this).GetComponent<MeshRenderer>();
_mpb = new MaterialPropertyBlock();
}
private void Update()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)this).transform;
transform.position += _vel * Time.deltaTime;
_t += Time.deltaTime;
float num = Mathf.Clamp01(1f - _t / _life);
Color val = default(Color);
((Color)(ref val))..ctor(_base.r, _base.g, _base.b, num);
if (Object.op_Implicit((Object)(object)_mr))
{
((Renderer)_mr).GetPropertyBlock(_mpb);
_mpb.SetColor("_Color", val);
if (_useEmission)
{
_mpb.SetColor("_EmissionColor", _base * Mathf.LinearToGammaSpace(num * _emissionMax));
}
((Renderer)_mr).SetPropertyBlock(_mpb);
}
if (_t >= _life)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
private class BassClone : MonoBehaviour
{
private MeshRenderer _mr;
private MaterialPropertyBlock _mpb;
private bool _useEmission;
private float _emissionMax;
private float _pulse;
private float _pulseSpeed;
private float _life;
private float _lifeMax;
public void Init(bool useEmission, float emissionMax, float pulseSpeed, float lifeMax)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
_useEmission = useEmission;
_emissionMax = emissionMax;
_pulseSpeed = pulseSpeed;
_mr = ((Component)this).GetComponent<MeshRenderer>();
_mpb = new MaterialPropertyBlock();
_lifeMax = lifeMax;
_life = _lifeMax;
}
public void Pulse(float amount)
{
_pulse = Mathf.Clamp01(_pulse + Mathf.Abs(amount));
}
public void RefreshLife(float life)
{
_life = Mathf.Max(_life, life);
}
public bool Tick()
{
//IL_0049: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
float deltaTime = Time.deltaTime;
_pulse = Mathf.MoveTowards(_pulse, 0f, deltaTime * _pulseSpeed);
_life -= deltaTime;
float num = 1f + _pulse;
((Component)this).transform.localScale = new Vector3(num, num, num);
if (Object.op_Implicit((Object)(object)_mr))
{
((Renderer)_mr).GetPropertyBlock(_mpb);
Color val = Color.Lerp(Color.white, Color.white, _pulse);
_mpb.SetColor("_Color", val);
if (_useEmission)
{
_mpb.SetColor("_EmissionColor", Color.white * Mathf.LinearToGammaSpace(_pulse * _emissionMax));
}
((Renderer)_mr).SetPropertyBlock(_mpb);
}
if (_life <= 0f)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return true;
}
return false;
}
}
[Header("Audio")]
public AudioClip oiiiCatSong;
private AudioSource _audio;
[Header("Spin Madness (music-driven)")]
[Tooltip("Base angular speed around Y (rad/s) when silent.")]
public float baseSpinSpeed = 1.5f;
[Tooltip("How much loudness adds to spin speed (rad/s).")]
public float spinSpeedPerLoudness = 35f;
[Tooltip("Proportional torque gain to chase target spin speed.")]
public float spinKp = 60f;
[Tooltip("Clamp for applied control torque.")]
public float maxControlTorque = 300f;
[Tooltip("Gain to normalize RMS loudness into 0..1.")]
public float loudnessGain = 35f;
public float crazyTime = 33f;
public float crazyForce = 10f;
[Header("Rave Lights")]
public int lightCount = 3;
public float lightMaxIntensity = 10f;
public float lightRange = 14f;
public float strobeChance = 0.25f;
public float strobeBoost = 1.75f;
[Header("Material FX")]
public bool useEmission = true;
public float emissionMax = 6f;
[Header("Particles")]
public bool enableParticles = true;
public int baseEmissionRate = 24;
public int crazyEmissionRate = 200;
[Header("Ghost Mesh Storm")]
public int ghostCount = 20;
public float ghostSpeed = 28f;
public float ghostLifetime = 6f;
public float ghostSpawnJitter = 2f;
[Header("Bass Clone FX")]
[Tooltip("Max number of clones parented to the cat that spawn/pulse on bass.")]
public int maxBassClones = 2;
[Tooltip("Minimum bass level to consider a peak (0..1).")]
public float bassPeakThreshold = 0.28f;
[Tooltip("Seconds between bass peak triggers.")]
public float bassPeakCooldown = 0.22f;
[Tooltip("Offset radius for where clones appear around the cat.")]
public float bassCloneOffset = 0.45f;
[Tooltip("Vertical lift so they’re not under the mesh.")]
public float bassCloneYOffset = 0.15f;
[Tooltip("How big the clones are relative to the main mesh.")]
public float bassCloneScale = 1f;
[Tooltip("How quickly clone pulse animates on a hit.")]
public float bassPulseSpeed = 12f;
[Tooltip("How large the pulse grows on a hit.")]
public float bassPulseAmount = 0.35f;
[Tooltip("Seconds a clone stays alive without new bass hits.")]
public float bassCloneLife = 1.4f;
private Rigidbody _rb;
private bool _crazy;
private bool _active;
private bool _grabbedPrev;
private float[] _spectrum = new float[1024];
private float[] _wave = new float[1024];
private int _sampleRate;
private float _loudEnv;
private float _bassEnv;
private float _bassPeakHold;
private float _bassCooldownTimer;
private readonly List<Light> _lights = new List<Light>(8);
private Renderer[] _renderers;
private MaterialPropertyBlock _mpb;
private ParticleSystem _ps;
private bool _ghostsSpawned;
private readonly List<BassClone> _bassClones = new List<BassClone>(4);
private static readonly Color[] _palette = (Color[])(object)new Color[7]
{
Color.red,
Color.green,
Color.blue,
Color.cyan,
Color.magenta,
Color.yellow,
Color.white
};
public override void Start()
{
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Expected O, but got Unknown
((Trap)this).Start();
_rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)_rb == (Object)null)
{
_rb = ((Component)this).gameObject.AddComponent<Rigidbody>();
_rb.mass = 2f;
}
_audio = ((Component)this).gameObject.AddComponent<AudioSource>();
_audio.clip = oiiiCatSong;
_audio.loop = false;
_audio.playOnAwake = false;
_audio.spatialBlend = 1f;
_audio.rolloffMode = (AudioRolloffMode)0;
_audio.minDistance = 4f;
_audio.maxDistance = 28f;
_renderers = ((Component)this).GetComponentsInChildren<Renderer>(true);
_mpb = new MaterialPropertyBlock();
_sampleRate = AudioSettings.outputSampleRate;
SetupRaveLights();
SetupParticles();
}
public override void Update()
{
//IL_0198: 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)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
((Trap)this).Update();
bool flag = (Object)(object)base.physGrabObject != (Object)null && base.physGrabObject.grabbed;
if (flag && !_grabbedPrev)
{
BeginTrap(broadcast: true);
}
_grabbedPrev = flag;
if (!_active || (Object)(object)_audio == (Object)null)
{
return;
}
float num = 0f;
if (_audio.isPlaying)
{
_audio.GetOutputData(_wave, 0);
double num2 = 0.0;
for (int i = 0; i < _wave.Length; i++)
{
num2 += (double)(_wave[i] * _wave[i]);
}
float num3 = Mathf.Sqrt((float)(num2 / (double)_wave.Length));
num = Mathf.Clamp01(num3 * loudnessGain);
_audio.GetSpectrumData(_spectrum, 0, (FFTWindow)5);
float input = BandEnergy(20f, 200f);
_loudEnv = EnvFollow(_loudEnv, num, 0.35f, 0.12f);
_bassEnv = EnvFollow(_bassEnv, input, 0.45f, 0.15f);
}
if (_audio.isPlaying)
{
float num4 = Mathf.Max(0f, baseSpinSpeed + _loudEnv * spinSpeedPerLoudness);
float num5 = Vector3.Dot(_rb.angularVelocity, ((Component)this).transform.up);
float num6 = num4 - num5;
float num7 = Mathf.Clamp(num6 * spinKp, 0f - maxControlTorque, maxControlTorque);
_rb.AddTorque(((Component)this).transform.up * num7, (ForceMode)5);
_rb.AddTorque(((Component)this).transform.right * (0.1f * num7), (ForceMode)5);
if (!_crazy && _audio.time >= crazyTime)
{
EnterCrazy(broadcast: true);
}
if (_crazy && Random.value < 0.2f)
{
_rb.AddForce(Random.onUnitSphere * crazyForce, (ForceMode)1);
}
_bassCooldownTimer -= Time.deltaTime;
bool flag2 = false;
if (_bassEnv > bassPeakThreshold && _bassEnv > _bassPeakHold && _bassCooldownTimer <= 0f)
{
flag2 = true;
_bassCooldownTimer = bassPeakCooldown;
}
_bassPeakHold = _bassEnv;
if (flag2)
{
OnBassPeak();
}
DriveLights(_loudEnv);
DriveMaterials(_loudEnv);
DriveParticles(_loudEnv);
UpdateBassClones();
if (_crazy && !_ghostsSpawned && _audio.time >= crazyTime + Random.Range(0f, ghostSpawnJitter))
{
_ghostsSpawned = true;
SpawnGhosts();
}
}
else
{
EndTrap(broadcast: true);
}
}
private float BandEnergy(float fLow, float fHigh)
{
if (_spectrum == null || _spectrum.Length == 0)
{
return 0f;
}
float num = (float)_sampleRate * 0.5f;
int num2 = _spectrum.Length;
int num3 = Mathf.Clamp(Mathf.RoundToInt(fLow / num * (float)(num2 - 1)), 0, num2 - 1);
int num4 = Mathf.Clamp(Mathf.RoundToInt(fHigh / num * (float)(num2 - 1)), 0, num2 - 1);
if (num4 < num3)
{
int num5 = num3;
num3 = num4;
num4 = num5;
}
float num6 = 0f;
for (int i = num3; i <= num4; i++)
{
num6 += _spectrum[i];
}
float num7 = num4 - num3 + 1;
return Mathf.Clamp01(num6 / Mathf.Max(1f, num7) * 12f);
}
private static float EnvFollow(float env, float input, float attack, float release)
{
float num = ((input > env) ? attack : release);
return Mathf.Lerp(env, input, num);
}
private void OnBassPeak()
{
if (_bassClones.Count < maxBassClones)
{
BassClone bassClone = CreateBassClone(_bassClones.Count);
if ((Object)(object)bassClone != (Object)null)
{
_bassClones.Add(bassClone);
}
}
for (int i = 0; i < _bassClones.Count; i++)
{
BassClone bassClone2 = _bassClones[i];
if (Object.op_Implicit((Object)(object)bassClone2))
{
bassClone2.Pulse(bassPulseAmount);
bassClone2.RefreshLife(bassCloneLife);
}
}
}
private BassClone CreateBassClone(int index)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_00d5: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: 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_0128: Unknown result type (might be due to invalid IL or missing references)
MeshFilter[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshFilter>(true);
Mesh val = null;
MeshRenderer val2 = null;
for (int i = 0; i < componentsInChildren.Length; i++)
{
if (Object.op_Implicit((Object)(object)componentsInChildren[i]) && Object.op_Implicit((Object)(object)componentsInChildren[i].sharedMesh))
{
val = componentsInChildren[i].sharedMesh;
val2 = ((Component)componentsInChildren[i]).GetComponent<MeshRenderer>();
break;
}
}
if (!Object.op_Implicit((Object)(object)val))
{
return null;
}
GameObject val3 = new GameObject($"BassClone_{index}");
val3.transform.SetParent(((Component)this).transform, false);
float num = (float)index / Mathf.Max(1f, (float)maxBassClones) * MathF.PI * 2f;
Vector3 localPosition = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * bassCloneOffset;
localPosition.y += bassCloneYOffset;
val3.transform.localPosition = localPosition;
val3.transform.localRotation = Quaternion.identity;
val3.transform.localScale = Vector3.one * bassCloneScale;
MeshFilter val4 = val3.AddComponent<MeshFilter>();
val4.sharedMesh = val;
MeshRenderer val5 = val3.AddComponent<MeshRenderer>();
if (Object.op_Implicit((Object)(object)val2) && ((Renderer)val2).sharedMaterials != null && ((Renderer)val2).sharedMaterials.Length != 0)
{
((Renderer)val5).sharedMaterial = ((Renderer)val2).sharedMaterials[0];
}
BassClone bassClone = val3.AddComponent<BassClone>();
bassClone.Init(useEmission, emissionMax, bassPulseSpeed, bassCloneLife);
return bassClone;
}
private void UpdateBassClones()
{
for (int num = _bassClones.Count - 1; num >= 0; num--)
{
BassClone bassClone = _bassClones[num];
if (!Object.op_Implicit((Object)(object)bassClone))
{
_bassClones.RemoveAt(num);
}
else if (bassClone.Tick())
{
_bassClones.RemoveAt(num);
}
}
}
private void SetupRaveLights()
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
foreach (Light light in _lights)
{
if (Object.op_Implicit((Object)(object)light))
{
Object.Destroy((Object)(object)((Component)light).gameObject);
}
}
_lights.Clear();
for (int i = 0; i < Mathf.Max(1, lightCount); i++)
{
GameObject val = new GameObject($"RaveLight_{i}");
val.transform.SetParent(((Component)this).transform, false);
Vector3 val2 = Random.onUnitSphere * 0.6f;
val2.y = Mathf.Abs(val2.y) * 0.5f + 0.05f;
val.transform.localPosition = val2;
Light val3 = val.AddComponent<Light>();
val3.type = (LightType)2;
val3.intensity = 0f;
val3.range = lightRange;
val3.shadows = (LightShadows)0;
_lights.Add(val3);
}
}
private void SetupParticles()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0076: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: 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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
if (enableParticles)
{
GameObject val = new GameObject("RaveParticles");
val.transform.SetParent(((Component)this).transform, false);
_ps = val.AddComponent<ParticleSystem>();
MainModule main = _ps.main;
((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1.2f);
((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(6f);
((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.1f);
((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
((MainModule)(ref main)).maxParticles = 2000;
EmissionModule emission = _ps.emission;
((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
ShapeModule shape = _ps.shape;
((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
((ShapeModule)(ref shape)).radius = 0.4f;
TrailModule trails = _ps.trails;
((TrailModule)(ref trails)).enabled = true;
((TrailModule)(ref trails)).lifetime = MinMaxCurve.op_Implicit(0.6f);
ColorOverLifetimeModule colorOverLifetime = _ps.colorOverLifetime;
((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
Gradient val2 = new Gradient();
val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
{
new GradientColorKey(Color.white, 0f),
new GradientColorKey(Color.cyan, 0.5f),
new GradientColorKey(Color.magenta, 1f)
}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
{
new GradientAlphaKey(1f, 0f),
new GradientAlphaKey(0f, 1f)
});
((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val2);
}
}
private void DriveLights(float loud)
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
if (_lights.Count == 0)
{
return;
}
float num = (((Object)(object)_audio != (Object)null) ? _audio.time : Time.time);
float num2 = default(float);
float num3 = default(float);
float num4 = default(float);
for (int i = 0; i < _lights.Count; i++)
{
Light val = _lights[i];
if (Object.op_Implicit((Object)(object)val))
{
Color val2 = _palette[(i + Mathf.FloorToInt(num * 2f)) % _palette.Length];
Color.RGBToHSV(val2, ref num2, ref num3, ref num4);
num2 = Mathf.Repeat(num2 + Mathf.Sin((num + (float)i) * 1.7f) * 0.1f, 1f);
Color color = Color.HSVToRGB(num2, 1f, 1f);
float num5 = loud * lightMaxIntensity;
if (_crazy && Random.value < strobeChance * Time.deltaTime * 60f)
{
num5 *= strobeBoost;
}
val.color = color;
val.intensity = Mathf.MoveTowards(val.intensity, num5, Time.deltaTime * lightMaxIntensity * 2f);
val.range = lightRange;
}
}
}
private void DriveMaterials(float loud)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_0104: Unknown result type (might be due to invalid IL or missing references)
if (_renderers == null || _renderers.Length == 0)
{
return;
}
float num = (((Object)(object)_audio != (Object)null) ? _audio.time : Time.time);
float num2 = Mathf.Repeat(num * (_crazy ? 2.5f : 1.2f) + loud * 0.5f, 1f);
Color val = Color.HSVToRGB(num2, 1f, 1f);
Color val2 = val * Mathf.LinearToGammaSpace(loud * emissionMax * (_crazy ? 1.2f : 1f));
Renderer[] renderers = _renderers;
foreach (Renderer val3 in renderers)
{
if (Object.op_Implicit((Object)(object)val3))
{
val3.GetPropertyBlock(_mpb);
_mpb.SetColor("_Color", val);
if (useEmission)
{
_mpb.SetColor("_EmissionColor", val2);
}
val3.SetPropertyBlock(_mpb);
}
}
}
private void DriveParticles(float loud)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_ps == (Object)null))
{
EmissionModule emission = _ps.emission;
int num = ((!_crazy) ? Mathf.RoundToInt((float)baseEmissionRate * loud) : Mathf.RoundToInt(Mathf.Lerp((float)baseEmissionRate, (float)crazyEmissionRate, loud)));
((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit((float)num);
if (!_ps.isPlaying && num > 0)
{
_ps.Play();
}
if (_ps.isPlaying && num <= 0)
{
_ps.Stop();
}
}
}
private void SpawnGhosts()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
MeshFilter[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshFilter>(true);
if (componentsInChildren == null || componentsInChildren.Length == 0)
{
return;
}
for (int i = 0; i < ghostCount; i++)
{
MeshFilter val = componentsInChildren[Random.Range(0, componentsInChildren.Length)];
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.sharedMesh))
{
GameObject val2 = new GameObject($"CatGhost_{i}");
val2.transform.position = ((Component)val).transform.position;
val2.transform.rotation = ((Component)val).transform.rotation;
MeshFilter val3 = val2.AddComponent<MeshFilter>();
val3.sharedMesh = val.sharedMesh;
MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>();
if (Object.op_Implicit((Object)(object)component) && ((Renderer)component).sharedMaterials != null && ((Renderer)component).sharedMaterials.Length != 0)
{
((Renderer)val4).sharedMaterial = ((Renderer)component).sharedMaterials[0];
}
Rigidbody val5 = val2.AddComponent<Rigidbody>();
val5.isKinematic = true;
Vector3 val6 = Random.onUnitSphere + ((Component)this).transform.up * 0.4f;
Vector3 normalized = ((Vector3)(ref val6)).normalized;
Vector3 velocity = normalized * Random.Range(ghostSpeed * 0.6f, ghostSpeed * 1.4f);
GhostFlyer ghostFlyer = val2.AddComponent<GhostFlyer>();
ghostFlyer.Init(velocity, ghostLifetime, _palette[Random.Range(0, _palette.Length)], useEmission, emissionMax);
}
}
}
private void BeginTrap(bool broadcast)
{
if (_active)
{
return;
}
if ((Object)(object)oiiiCatSong == (Object)null)
{
Debug.LogWarning((object)"[ValuableCat] No OIII cat song assigned!");
return;
}
_active = true;
_crazy = false;
_ghostsSpawned = false;
_bassClones.Clear();
_loudEnv = 0f;
_bassEnv = 0f;
_bassPeakHold = 0f;
_bassCooldownTimer = 0f;
_audio.time = 0f;
_audio.Play();
if (Object.op_Implicit((Object)(object)_rb))
{
_rb.drag = 0.02f;
_rb.angularDrag = 0.01f;
_rb.maxAngularVelocity = 200f;
}
foreach (Light light in _lights)
{
if (Object.op_Implicit((Object)(object)light))
{
light.intensity = 0f;
}
}
if (Object.op_Implicit((Object)(object)_ps))
{
_ps.Clear(true);
_ps.Play();
}
if (broadcast && SemiFunc.IsMultiplayer())
{
base.photonView.RPC("RPC_StartCatSpin", (RpcTarget)1, Array.Empty<object>());
}
}
private void EndTrap(bool broadcast)
{
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
if (!_active)
{
return;
}
_active = false;
_crazy = false;
_ghostsSpawned = false;
if (Object.op_Implicit((Object)(object)_audio))
{
_audio.Stop();
}
foreach (Light light in _lights)
{
if (Object.op_Implicit((Object)(object)light))
{
light.intensity = 0f;
}
}
if (Object.op_Implicit((Object)(object)_ps))
{
_ps.Stop(true, (ParticleSystemStopBehavior)0);
}
if (_renderers != null)
{
Renderer[] renderers = _renderers;
foreach (Renderer val in renderers)
{
if (Object.op_Implicit((Object)(object)val))
{
val.GetPropertyBlock(_mpb);
_mpb.SetColor("_Color", Color.white);
if (useEmission)
{
_mpb.SetColor("_EmissionColor", Color.black);
}
val.SetPropertyBlock(_mpb);
}
}
}
for (int j = 0; j < _bassClones.Count; j++)
{
if (Object.op_Implicit((Object)(object)_bassClones[j]))
{
Object.Destroy((Object)(object)((Component)_bassClones[j]).gameObject);
}
}
_bassClones.Clear();
if (broadcast && SemiFunc.IsMultiplayer())
{
base.photonView.RPC("RPC_StopCatSpin", (RpcTarget)1, Array.Empty<object>());
}
}
private void EnterCrazy(bool broadcast)
{
_crazy = true;
if (Object.op_Implicit((Object)(object)_rb))
{
_rb.drag = 0f;
_rb.angularDrag = 0.008f;
_rb.maxAngularVelocity = 240f;
}
if (broadcast && SemiFunc.IsMultiplayer())
{
base.photonView.RPC("RPC_CatCrazy", (RpcTarget)1, Array.Empty<object>());
}
}
[PunRPC]
private void RPC_StartCatSpin()
{
BeginTrap(broadcast: false);
}
[PunRPC]
private void RPC_StopCatSpin()
{
EndTrap(broadcast: false);
}
[PunRPC]
private void RPC_CatCrazy()
{
EnterCrazy(broadcast: false);
}
}
[BepInPlugin("omniscye.oia_valuable", "OIA Valuable", "1.0.0")]
public class OIAValuablePlugin : BaseUnityPlugin
{
private void Awake()
{
Debug.Log((object)"[OIA Valuable] Plugin loaded. Rave cat armed.");
}
}