PORO.dll

Decompiled a week ago
using System;
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.Logging;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("PORO")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("P.O.R.O.")]
[assembly: AssemblyTitle("PORO")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PORO;

internal class EvilPoroTrap : Trap
{
	private PhysGrabObject physgrabobject;

	[Space]
	[Header("Frog Components")]
	public GameObject Frog;

	public GameObject NonRotate;

	[Space]
	[Header("Sounds")]
	public Sound CrankStart;

	public Sound CrankEnd;

	public Sound CrankLoop;

	public Sound Jump;

	[Space]
	public AnimationCurve FrogJumpCurve;

	private float FrogJumpLerp;

	public float FrogJumpSpeed;

	public float upMult;

	public float forwardMult;

	private bool FrogJumpActive;

	public float FrogJumpIntensity;

	[Space]
	[Header("Squeeze Animation")]
	public AnimationCurve HeadSqueezeCurve;

	private bool HeadSqueezeActive;

	public float HeadSqueezeSpeed;

	public float HeadSqueezeIntensity;

	private float HeadSqueezeLerp;

	[Space]
	[Header("Jump Delay Lerp")]
	public float minJumpSpeedupMult = 1.7f;

	[Space]
	[Header("Jump Delay Lerp")]
	public float maxJumpSpeedupMult = 0.5f;

	public float timeToCalmDown = 7f;

	public float calmLerpProgress;

	protected float baseScale = 0.02f;

	private Quaternion initialFrogRotation;

	private Rigidbody rb;

	private bool LoopPlaying;

	private bool everPickedUp;

	private float frogJumpTimer;

	private PhysGrabObjectImpactDetector impactDetector;

	private bool grabbedPrev;

	public float minJumpDelay = 0.5f;

	public float maxJumpDelay = 0.8f;

	protected override void Start()
	{
		//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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		((Trap)this).Start();
		impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
		initialFrogRotation = Frog.transform.localRotation;
		rb = ((Component)this).GetComponent<Rigidbody>();
		physgrabobject = ((Component)this).GetComponent<PhysGrabObject>();
		baseScale = (Frog.transform.localScale.x + Frog.transform.localScale.y + Frog.transform.localScale.z) / 3f;
	}

	protected override void Update()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: 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_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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		((Trap)this).Update();
		CrankLoop.PlayLoop(LoopPlaying, 0.8f, 0.8f, 1f);
		if (base.physGrabObject.grabbed)
		{
			if (!grabbedPrev)
			{
				Jump.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
				grabbedPrev = true;
				if (base.physGrabObject.grabbedLocal)
				{
					PhysGrabber.instance.OverrideGrabDistance(0.8f);
					if (SemiFunc.IsMasterClientOrSingleplayer())
					{
						Quaternion val = Quaternion.Euler(45f, 180f, 0f);
						Quaternion val2 = Quaternion.Euler(0f, 0f, 0f);
						Quaternion identity = Quaternion.identity;
						base.physGrabObject.TurnXYZ(val, val2, identity);
					}
				}
			}
			everPickedUp = true;
			LoopPlaying = false;
			if (base.trapActive)
			{
				TrapStop();
			}
		}
		else
		{
			grabbedPrev = false;
			if (everPickedUp)
			{
				base.trapStart = true;
			}
		}
		if (base.trapStart && !impactDetector.inCart)
		{
			TrapActivate();
		}
		if (!base.trapActive || base.physGrabObject.grabbed)
		{
			return;
		}
		base.enemyInvestigate = true;
		LoopPlaying = true;
		if (FrogJumpActive)
		{
			FrogJumpLerp += FrogJumpSpeed * Time.deltaTime;
			if (FrogJumpLerp >= 1f)
			{
				FrogJumpLerp = 0f;
				FrogJumpActive = false;
			}
		}
		if (HeadSqueezeActive)
		{
			HeadSqueezeLerp += HeadSqueezeSpeed * Time.deltaTime;
			base.enemyInvestigate = true;
			if (HeadSqueezeLerp >= 1f)
			{
				HeadSqueezeLerp = 0f;
				HeadSqueezeActive = false;
				base.trapTriggered = false;
			}
		}
		float num = baseScale * (1f + HeadSqueezeCurve.Evaluate(HeadSqueezeLerp) * HeadSqueezeIntensity);
		Frog.transform.localScale = new Vector3(num, num, num);
		float num2 = 40f;
		float num3 = 1f * Mathf.Sin(Time.time * num2);
		float num4 = 1f * Mathf.Sin(Time.time * num2 + MathF.PI / 2f);
		Frog.transform.localRotation = initialFrogRotation * Quaternion.Euler(num3, 0f, num4);
		Frog.transform.localPosition = new Vector3(Frog.transform.localPosition.x, Frog.transform.localPosition.y - num3 * 0.005f * Time.deltaTime, Frog.transform.localPosition.z);
		if (frogJumpTimer > 0f)
		{
			calmLerpProgress += Time.deltaTime;
			calmLerpProgress = Mathf.Min(calmLerpProgress, timeToCalmDown);
			frogJumpTimer -= Time.deltaTime * Mathf.Lerp(minJumpSpeedupMult, maxJumpSpeedupMult, calmLerpProgress / timeToCalmDown);
		}
		else if (SemiFunc.IsMultiplayer())
		{
			if (SemiFunc.IsMasterClient())
			{
				base.photonView.RPC("FrogJumpRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}
		else
		{
			FrogJump();
		}
	}

	public void FrogJump()
	{
		//IL_003e: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: 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_00d6: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: 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_0112: 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_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		if (impactDetector.inCart)
		{
			TrapStop();
			return;
		}
		frogJumpTimer = Random.Range(minJumpDelay, maxJumpDelay);
		base.enemyInvestigate = true;
		Jump.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
		FrogJumpActive = true;
		FrogJumpLerp = 0f;
		base.enemyInvestigateRange = 5f;
		HeadSqueezeActive = true;
		HeadSqueezeLerp = 0f;
		if (base.isLocal)
		{
			Vector3 insideUnitSphere;
			if (Vector3.Dot(Frog.transform.up, Vector3.up) > 0.5f)
			{
				rb.AddForce(Vector3.up * 4f * upMult, (ForceMode)1);
				rb.AddForce(((Component)this).transform.forward * 2.5f * forwardMult, (ForceMode)1);
				insideUnitSphere = Random.insideUnitSphere;
				Vector3 val = ((Vector3)(ref insideUnitSphere)).normalized * Random.Range(0.05f, 0.1f);
				val.z = 0f;
				val.x = 0f;
				rb.AddTorque(val * 0.25f, (ForceMode)1);
			}
			else
			{
				rb.AddForce(Vector3.up * 4f * upMult, (ForceMode)1);
				insideUnitSphere = Random.insideUnitSphere;
				Vector3 normalized = ((Vector3)(ref insideUnitSphere)).normalized;
				rb.AddTorque(normalized * 0.03f, (ForceMode)1);
			}
		}
	}

	[PunRPC]
	public void FrogJumpRPC()
	{
		FrogJump();
	}

	public void TrapStop()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		base.trapActive = false;
		base.trapStart = false;
		LoopPlaying = false;
		base.trapTriggered = false;
		CrankEnd.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
		calmLerpProgress = 0f;
	}

	public void TrapActivate()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		if (!base.trapTriggered)
		{
			CrankStart.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
			base.trapActive = true;
			base.trapTriggered = true;
		}
	}
}
public static class Constants
{
	public const string GUID = "me.excuze.repomods.poro";

	public const string NAME = "P.O.R.O.";

	public const string VERSION = "1.0.0";
}
[BepInPlugin("PORO", "P.O.R.O.", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ManualLogSource Logger;

	private void Awake()
	{
		Logger = ((BaseUnityPlugin)this).Logger;
		Logger.LogInfo((object)"Plugin PORO is loaded!");
	}
}
public class PlushieTrap : Trap
{
	protected PhysGrabObject physgrabobject;

	private MeshRenderer mesh;

	protected float baseScale = 0.02f;

	[Space]
	[Header("Plushie Components")]
	public GameObject Plushie;

	[Space]
	[Header("Sounds")]
	public Sound PlushVO;

	[Space]
	[Header("Head Squeeze Animation")]
	public AnimationCurve HeadSqueezeCurve;

	private bool HeadSqueezeActive;

	public float HeadSqueezeSpeed;

	public float HeadSqueezeIntensity;

	private float HeadSqueezeLerp;

	protected override void Start()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		((Trap)this).Start();
		physgrabobject = ((Component)this).GetComponent<PhysGrabObject>();
		mesh = Plushie.GetComponent<MeshRenderer>();
		baseScale = (Plushie.transform.localScale.x + Plushie.transform.localScale.y + Plushie.transform.localScale.z) / 3f;
	}

	protected override void Update()
	{
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		((Trap)this).Update();
		if (!base.trapActive)
		{
			return;
		}
		base.enemyInvestigateRange = 5f;
		if (HeadSqueezeActive)
		{
			HeadSqueezeLerp += HeadSqueezeSpeed * Time.deltaTime;
			base.enemyInvestigate = true;
			if (HeadSqueezeLerp >= 1f)
			{
				HeadSqueezeLerp = 0f;
				HeadSqueezeActive = false;
				base.trapTriggered = false;
			}
		}
		float num = baseScale * (1f + HeadSqueezeCurve.Evaluate(HeadSqueezeLerp) * HeadSqueezeIntensity);
		Plushie.transform.localScale = new Vector3(num, num, num);
	}

	public virtual void TrapStop()
	{
		base.trapActive = false;
		physgrabobject.dead = true;
	}

	protected virtual void TrapActivate()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		if (!base.trapTriggered)
		{
			PlushVO.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
			HeadSqueezeActive = true;
			base.trapActive = true;
			base.trapTriggered = true;
		}
	}

	private void TouchHeadLogic()
	{
		TrapActivate();
	}

	public void TouchHead()
	{
		if (GameManager.instance.gameMode == 0)
		{
			TouchHeadLogic();
		}
		else if (PhotonNetwork.IsMasterClient)
		{
			base.photonView.RPC("TouchHeadRPC", (RpcTarget)0, Array.Empty<object>());
		}
	}

	[PunRPC]
	private void TouchHeadRPC()
	{
		TouchHeadLogic();
	}
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "PORO";

	public const string PLUGIN_NAME = "P.O.R.O.";

	public const string PLUGIN_VERSION = "1.0.0";
}