Decompiled source of KpopDemonHuntersValuables v1.0.0

KDHValuablesMod.dll

Decompiled 2 months ago
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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sirenix.Utilities;
using UnityEngine;
using UnityEngine.Events;

[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("OrigamiCoder")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KDHValuablesMod")]
[assembly: AssemblyTitle("KDHValuablesMod")]
[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;
		}
	}
}
namespace KDHValuablesMod
{
	public class KDHValuablesConfig
	{
		private KDHValuablesMod Plugin;

		private ConfigEntry<bool> StreamerMode;

		public bool IsStreamerMode => StreamerMode.Value;

		public KDHValuablesConfig(KDHValuablesMod plugin)
		{
			Plugin = plugin;
			StreamerMode = ((BaseUnityPlugin)plugin).Config.Bind<bool>("General", "StreamerMode", false, (ConfigDescription)null);
		}
	}
	[BepInPlugin("OrigamiCoder.KDHValuablesMod", "KDHValuablesMod", "1.0")]
	public class KDHValuablesMod : BaseUnityPlugin
	{
		internal static KDHValuablesConfig PluginConfig;

		internal static KDHValuablesMod 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();
			PluginConfig = new KDHValuablesConfig(this);
			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()
		{
		}
	}
	public class ValuableHuntrixLightstick : ValuableLightstick
	{
		protected override void GenerateLyrics(out List<string> lyrics)
		{
			lyrics = new List<string>
			{
				"I'm done hiding, now I'm shining like I'm born to be", "We dreamed hard, we came so far, now I believe", "We're goin up, up, up, it's our moment", "You know together we're glowing", "Gonna be, gonna be golden", "Oh, up, up, up with our voices", "Gonna be, gonna be golden", "I'm done hiding, now I'm shining, like I'm born to be", "Oh, our time, no fears, no lies, that's who we're born to be", "No more hiding, I'll be shining like I'm born to be",
				"Cause we are hunters, voices strong, and I know I believe"
			};
		}
	}
	public abstract class ValuableLightstick : MonoBehaviour
	{
		protected enum State
		{
			Idle,
			Active
		}

		[SerializeField]
		protected Color possessColor = Color.white;

		protected PhysGrabObject physGrabObject;

		protected float coolDownUntilNextSentence = 3f;

		protected ParticleSystem particles;

		protected bool particlesPlaying;

		protected State currentState;

		public virtual void Start()
		{
			particles = ((Component)this).GetComponentInChildren<ParticleSystem>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		}

		protected virtual void Update()
		{
			if (physGrabObject.grabbed)
			{
				if (!particlesPlaying)
				{
					particles.Play();
					particlesPlaying = true;
				}
			}
			else if (particlesPlaying)
			{
				particles.Stop();
				particlesPlaying = false;
			}
			if (SemiFunc.IsMultiplayer())
			{
				switch (currentState)
				{
				case State.Idle:
					StateIdle();
					break;
				case State.Active:
					StateActive();
					break;
				}
			}
		}

		protected virtual void StateIdle()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (coolDownUntilNextSentence > 0f && physGrabObject.grabbed)
			{
				coolDownUntilNextSentence -= Time.deltaTime;
			}
			else if (Object.op_Implicit((Object)(object)PhysGrabber.instance) && PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject)
			{
				string text = GenerateLyricSentence();
				currentState = State.Active;
				ChatManager.instance.PossessChatScheduleStart(10);
				ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, possessColor, 0f, false, 0, (UnityEvent)null);
				ChatManager.instance.PossessChatScheduleEnd();
			}
		}

		protected virtual void StateActive()
		{
			if (PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)(object)physGrabObject)
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(5f, 15f);
			}
			else if (!ChatManager.instance.StateIsPossessed())
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(5f, 15f);
			}
		}

		protected virtual string GenerateLyricSentence()
		{
			GenerateLyrics(out List<string> lyrics);
			if (LinqExtensions.IsNullOrEmpty<string>((IList<string>)lyrics))
			{
				return "";
			}
			string text = lyrics[Random.Range(0, lyrics.Count)];
			return char.ToUpper(text[0]) + text.Substring(1);
		}

		protected abstract void GenerateLyrics(out List<string> lyrics);
	}
	public class ValuableSajaBoysLightstick : ValuableLightstick
	{
		protected override void GenerateLyrics(out List<string> lyrics)
		{
			lyrics = new List<string>
			{
				"I'm the only one who'll love your sins", "Feel the way my voice gets underneath your skin", "Listen cause I'm preachin to the choir", "Can I get the mic a little higher?", "Gimme your desire", "I can be the star you rely on", "Don't you know I'm here to save you?", "Now we runnin wild", "Yeah, I'm all you need, I'ma be your idol", "Living in your mind now, too late cause you're mine now",
				"I will make you free when you're all a part of me", "Watch me set your world on fire", "No one is coming to save you", "You're down on your knees, I'ma be your idol"
			};
		}
	}
	public class ValuableSodaPop : Trap
	{
		[Header("Sounds")]
		public Sound soundBoomboxStart;

		public Sound soundBoomboxStop;

		public Sound soundBoomboxMusic;

		public Sound soundBoomboxMusicFallback;

		[Space]
		public Transform speaker1;

		public Transform speaker2;

		[Space]
		public Light light1;

		public Light light2;

		public override void Start()
		{
			((Trap)this).Start();
			((Behaviour)light1).enabled = false;
			((Behaviour)light2).enabled = false;
		}

		public override void Update()
		{
			//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)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: 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)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			((Trap)this).Update();
			if (!base.trapTriggered && base.physGrabObject.grabbed)
			{
				base.trapStart = true;
			}
			if (base.physGrabObject.grabbed)
			{
				bool isStreamerMode = KDHValuablesMod.PluginConfig.IsStreamerMode;
				soundBoomboxMusic.PlayLoop(!isStreamerMode, 2f, 2f, 1f);
				soundBoomboxMusicFallback.PlayLoop(isStreamerMode, 2f, 2f, 1f);
				base.enemyInvestigate = true;
				float num = 1f + Mathf.Sin(Time.time * 80f) * 0.005f;
				speaker1.localScale = new Vector3(num, num, num);
				speaker2.localScale = new Vector3(num, num, num);
				float num2 = Mathf.PingPong(Time.time * 0.5f, 1f);
				float num3 = 1f;
				if (SemiFunc.Photosensitivity())
				{
					num2 = 0.75f;
					num3 = 0.5f;
				}
				Color val = Color.Lerp(((Component)speaker1).GetComponent<Renderer>().material.GetColor("_EmissionColor"), Color.HSVToRGB(num2, 1f, 1f), Time.deltaTime * 6000f);
				((Component)speaker1).GetComponent<Renderer>().materials[^1].SetColor("_EmissionColor", val);
				((Component)speaker2).GetComponent<Renderer>().materials[^1].SetColor("_EmissionColor", val);
				((Behaviour)light1).enabled = true;
				((Behaviour)light2).enabled = true;
				light1.color = val;
				light2.color = val;
				light1.intensity = Mathf.Lerp(light1.intensity, 4f, num3 * Time.deltaTime);
				light2.intensity = Mathf.Lerp(light2.intensity, 4f, num3 * Time.deltaTime);
			}
			else
			{
				soundBoomboxMusic.PlayLoop(false, 2f, 2f, 1f);
				soundBoomboxMusicFallback.PlayLoop(false, 2f, 2f, 1f);
				if (((Behaviour)light1).enabled)
				{
					Color val2 = Color.Lerp(((Component)speaker1).GetComponent<Renderer>().material.GetColor("_EmissionColor"), Color.black, Time.deltaTime);
					((Component)speaker1).GetComponent<Renderer>().material.SetColor("_EmissionColor", val2);
					((Component)speaker2).GetComponent<Renderer>().material.SetColor("_EmissionColor", val2);
					speaker1.localScale = Vector3.Lerp(speaker1.localScale, Vector3.one, Time.deltaTime);
					speaker2.localScale = Vector3.Lerp(speaker2.localScale, Vector3.one, Time.deltaTime);
					light1.intensity = Mathf.Lerp(light1.intensity, 0f, Time.deltaTime);
					light2.intensity = Mathf.Lerp(light2.intensity, 0f, Time.deltaTime);
					if (light1.intensity < 0.01f)
					{
						((Component)speaker1).GetComponent<Renderer>().material.SetColor("_EmissionColor", Color.black);
						((Component)speaker2).GetComponent<Renderer>().material.SetColor("_EmissionColor", Color.black);
						((Behaviour)light1).enabled = false;
						((Behaviour)light2).enabled = false;
						speaker1.localScale = Vector3.one;
						speaker2.localScale = Vector3.one;
					}
				}
			}
			if (!base.physGrabObject.grabbed)
			{
				return;
			}
			float num4 = Mathf.Sin(Time.time * 15f) * 0.5f;
			float num5 = Mathf.Sin(Time.time * 15f) * 25f;
			foreach (PhysGrabber item in base.physGrabObject.playerGrabbing)
			{
				if (item.isLocal)
				{
					CameraAim.Instance.AdditiveAimY(num4);
					item.OverrideGrabDistance(1f);
					item.OverrideDisableRotationControls();
					item.playerAvatar.playerExpression.OverrideExpressionSet(4, 100f);
					PlayerExpressionsUI.instance.playerExpression.OverrideExpressionSet(4, 100f);
					PlayerExpressionsUI.instance.playerAvatarVisuals.HeadTiltOverride(num5 * 0.5f);
				}
				else
				{
					item.playerAvatar.playerAvatarVisuals.HeadTiltOverride(num5);
				}
			}
		}
	}
}