Decompiled source of LewdCompany v1.2.0

plugins/LewdCompany/LewdCompany.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LewdCompany;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LewdCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LewdCompany")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b8e44f17-f4e0-4a6a-a653-2ea30a13222c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class Bracken : NetworkBehaviour
{
	private PlayerControllerB targetPlayer;

	private Animator bracken_anim;

	private Animator maleAnimator;

	private GameObject male;

	private bool played;

	private Coroutine animation_coroutine;

	private AudioSource audio_src;

	public override void OnNetworkSpawn()
	{
		((NetworkBehaviour)this).OnNetworkSpawn();
		if ((Object)(object)((Component)this).GetComponent<BrackenInteraction>() == (Object)null)
		{
			((Component)this).gameObject.AddComponent<BrackenInteraction>();
		}
		bracken_anim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)bracken_anim == (Object)null)
		{
			bracken_anim = ((Component)this).GetComponentInChildren<Animator>();
		}
		if ((Object)(object)bracken_anim != (Object)null)
		{
			bracken_anim.SetTrigger("idle");
		}
		male = null;
		maleAnimator = null;
		Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == "man_mesh")
			{
				male = ((Component)val).gameObject;
				maleAnimator = ((Component)val).GetComponent<Animator>();
				if ((Object)(object)maleAnimator == (Object)null)
				{
					maleAnimator = ((Component)val).GetComponentInChildren<Animator>();
				}
			}
		}
		if ((Object)(object)male == (Object)null)
		{
			SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val2 in componentsInChildren2)
			{
				string text = ((Object)val2).name.ToLower();
				if (text.Contains("man") || text.Contains("male"))
				{
					male = ((Component)val2).gameObject;
					maleAnimator = ((Component)val2).GetComponent<Animator>();
					if ((Object)(object)maleAnimator == (Object)null)
					{
						maleAnimator = ((Component)val2).GetComponentInChildren<Animator>();
					}
					break;
				}
			}
		}
		audio_src = ((Component)this).GetComponent<AudioSource>();
		if ((Object)(object)audio_src == (Object)null)
		{
			audio_src = ((Component)this).gameObject.AddComponent<AudioSource>();
		}
		audio_src.spatialBlend = 1f;
		audio_src.minDistance = 2f;
		audio_src.maxDistance = 20f;
		audio_src.playOnAwake = false;
		audio_src.loop = false;
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(false);
		}
		target_player();
	}

	private void Update()
	{
		//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)
		//IL_0069: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		if (played || (!((NetworkBehaviour)this).IsServer && !((NetworkBehaviour)this).IsHost))
		{
			return;
		}
		if ((Object)(object)targetPlayer == (Object)null)
		{
			target_player();
		}
		else if (targetPlayer.isPlayerControlled && !targetPlayer.isPlayerDead)
		{
			Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position;
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude > 0.1f)
			{
				Quaternion val2 = Quaternion.LookRotation(val);
				((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 5f);
			}
		}
	}

	private void target_player()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		float num = float.MaxValue;
		PlayerControllerB val = null;
		if ((Object)(object)StartOfRound.Instance != (Object)null)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if ((Object)(object)val2 != (Object)null && val2.isPlayerControlled && !val2.isPlayerDead)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = val2;
					}
				}
			}
		}
		targetPlayer = val;
	}

	public void strip_state(bool show)
	{
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(show);
		}
	}

	public bool nude()
	{
		return true;
	}

	[ServerRpc(RequireOwnership = false)]
	public void RequestStartSexServerRpc(string triggerName)
	{
		start_sex(triggerName);
	}

	public void start_sex(string triggerName)
	{
		if ((Object)(object)bracken_anim == (Object)null)
		{
			return;
		}
		bool flag = false;
		AnimatorControllerParameter[] parameters = bracken_anim.parameters;
		for (int i = 0; i < parameters.Length; i++)
		{
			if (parameters[i].name == triggerName)
			{
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			return;
		}
		played = true;
		if (lewd(triggerName))
		{
			strip_state(show: true);
		}
		float num = length(triggerName);
		if (num <= 0f)
		{
			num = 3f;
		}
		float num2 = 1f;
		if ((Object)(object)maleAnimator != (Object)null)
		{
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				float num3 = male_length(text);
				num2 = ((num3 > 0f) ? (num3 / num) : 1f);
				maleAnimator.speed = num2;
			}
		}
		bracken_anim.SetTrigger(triggerName);
		PlayTriggerClientRpc(triggerName, num2);
		if (animation_coroutine != null)
		{
			((MonoBehaviour)this).StopCoroutine(animation_coroutine);
		}
		animation_coroutine = ((MonoBehaviour)this).StartCoroutine(souls(num + 0.3f));
	}

	[ClientRpc]
	private void PlayTriggerClientRpc(string triggerName, float maleSpeed)
	{
		if ((Object)(object)bracken_anim != (Object)null)
		{
			bracken_anim.SetTrigger(triggerName);
		}
		if (lewd(triggerName) && (Object)(object)male != (Object)null)
		{
			male.SetActive(true);
		}
		if ((Object)(object)maleAnimator != (Object)null && maleSpeed > 0f)
		{
			maleAnimator.speed = maleSpeed;
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				maleAnimator.SetTrigger(text);
			}
		}
		if (!((Object)(object)audio_src != (Object)null) || !((Object)(object)LewdCompanionManager.Instance != (Object)null))
		{
			return;
		}
		LewdCompanionManager instance = LewdCompanionManager.Instance;
		if (triggerName.Contains("fast"))
		{
			AudioClip val = instance.pick_sfx("moan");
			if ((Object)(object)val != (Object)null)
			{
				audio_src.PlayOneShot(val);
			}
			AudioClip val2 = instance.pick_sfx("pounding");
			if ((Object)(object)val2 != (Object)null)
			{
				audio_src.PlayOneShot(val2);
			}
		}
		else if (triggerName.Contains("cum"))
		{
			AudioClip val3 = instance.pick_sfx("ahh");
			if ((Object)(object)val3 != (Object)null)
			{
				audio_src.PlayOneShot(val3);
			}
		}
		else if (triggerName.Contains("slow"))
		{
			AudioClip val4 = instance.pick_sfx("moan");
			if ((Object)(object)val4 != (Object)null)
			{
				audio_src.PlayOneShot(val4);
			}
			AudioClip val5 = instance.pick_sfx("slide");
			if ((Object)(object)val5 != (Object)null)
			{
				audio_src.PlayOneShot(val5);
			}
		}
	}

	public void state_idle()
	{
		if ((Object)(object)bracken_anim != (Object)null)
		{
			bracken_anim.SetTrigger("idle");
		}
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(false);
		}
	}

	private string get_male_trigger(string f)
	{
		if (f.Contains("handjob"))
		{
			return "m_handjob_static";
		}
		if (f.Contains("paizuri"))
		{
			return "m_paizuri_static";
		}
		if (f.Contains("doggy"))
		{
			if (f.Contains("start"))
			{
				return "m_doggy_br_start";
			}
			if (f.Contains("slow"))
			{
				return "m_doggy_br_slow";
			}
			if (f.Contains("fast"))
			{
				return "m_doggy_br_fast";
			}
			if (f.Contains("cum"))
			{
				return "m_doggy_br_cum";
			}
		}
		return "";
	}

	public float GetFemaleLength(string name)
	{
		return length(name);
	}

	public float GetMaleLength(string name)
	{
		return male_length(name);
	}

	private float length(string t)
	{
		if ((Object)(object)bracken_anim == (Object)null || (Object)(object)bracken_anim.runtimeAnimatorController == (Object)null)
		{
			return 120f;
		}
		AnimationClip[] animationClips = bracken_anim.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(t.ToLower()) || t.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 120f;
	}

	private float male_length(string t)
	{
		if ((Object)(object)maleAnimator == (Object)null || (Object)(object)maleAnimator.runtimeAnimatorController == (Object)null)
		{
			return 0f;
		}
		AnimationClip[] animationClips = maleAnimator.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(t.ToLower()) || t.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 0f;
	}

	private IEnumerator souls(float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		played = false;
		animation_coroutine = null;
	}

	private bool lewd(string t)
	{
		if (!t.Contains("handjob") && !t.Contains("paizuri"))
		{
			return t.Contains("doggy");
		}
		return true;
	}
}
public class LewdCompanionAI : NetworkBehaviour
{
	private PlayerControllerB targetPlayer;

	private Animator slut_anim;

	private Animator maleAnimator;

	private GameObject wtf;

	private GameObject male;

	private bool strip;

	private bool played;

	private Coroutine animation_coroutine;

	private AudioSource audio_src;

	public override void OnNetworkSpawn()
	{
		((NetworkBehaviour)this).OnNetworkSpawn();
		if ((Object)(object)((Component)this).GetComponent<LewdCompanionInteraction>() == (Object)null)
		{
			((Component)this).gameObject.AddComponent<LewdCompanionInteraction>();
		}
		slut_anim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)slut_anim == (Object)null)
		{
			slut_anim = ((Component)this).GetComponentInChildren<Animator>();
		}
		if ((Object)(object)slut_anim != (Object)null)
		{
			slut_anim.SetTrigger("idle");
		}
		audio_src = ((Component)this).GetComponent<AudioSource>();
		if ((Object)(object)audio_src == (Object)null)
		{
			audio_src = ((Component)this).gameObject.AddComponent<AudioSource>();
		}
		audio_src.spatialBlend = 1f;
		audio_src.minDistance = 2f;
		audio_src.maxDistance = 20f;
		audio_src.playOnAwake = false;
		audio_src.loop = false;
		male = null;
		maleAnimator = null;
		wtf = null;
		Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == "man_mesh")
			{
				male = ((Component)val).gameObject;
				maleAnimator = ((Component)val).GetComponent<Animator>();
				if ((Object)(object)maleAnimator == (Object)null)
				{
					maleAnimator = ((Component)val).GetComponentInChildren<Animator>();
				}
			}
			else if (((Object)val).name == "Suit")
			{
				wtf = ((Component)val).gameObject;
			}
			else if (((Object)val).name == "CamPiv" || ((Object)val).name == "SexCam")
			{
				Camera componentInChildren = ((Component)val).GetComponentInChildren<Camera>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					((Behaviour)componentInChildren).enabled = false;
				}
			}
		}
		if ((Object)(object)male == (Object)null)
		{
			SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val2 in componentsInChildren2)
			{
				string text = ((Object)val2).name.ToLower();
				if (text.Contains("man") || text.Contains("male"))
				{
					male = ((Component)val2).gameObject;
					maleAnimator = ((Component)val2).GetComponent<Animator>();
					if ((Object)(object)maleAnimator == (Object)null)
					{
						maleAnimator = ((Component)val2).GetComponentInChildren<Animator>();
					}
					break;
				}
			}
		}
		if ((Object)(object)wtf != (Object)null)
		{
			wtf.SetActive(true);
		}
		if ((Object)(object)male != (Object)null)
		{
			SkinnedMeshRenderer component = male.GetComponent<SkinnedMeshRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				((Renderer)component).enabled = false;
			}
			else
			{
				male.SetActive(false);
			}
		}
		strip = false;
		if ((Object)(object)slut_anim != (Object)null)
		{
			slut_anim.SetBool("isUndressed", false);
		}
		target_player();
	}

	private void Update()
	{
		//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)
		//IL_0069: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		if (played || (!((NetworkBehaviour)this).IsServer && !((NetworkBehaviour)this).IsHost))
		{
			return;
		}
		if ((Object)(object)targetPlayer == (Object)null)
		{
			target_player();
		}
		else if (targetPlayer.isPlayerControlled && !targetPlayer.isPlayerDead)
		{
			Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position;
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude > 0.1f)
			{
				Quaternion val2 = Quaternion.LookRotation(val);
				((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 5f);
			}
		}
	}

	private void target_player()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		float num = float.MaxValue;
		PlayerControllerB val = null;
		if ((Object)(object)StartOfRound.Instance != (Object)null)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if ((Object)(object)val2 != (Object)null && val2.isPlayerControlled && !val2.isPlayerDead)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = val2;
					}
				}
			}
		}
		targetPlayer = val;
	}

	public void strip_state(bool undress)
	{
		strip = undress;
		if ((Object)(object)wtf != (Object)null)
		{
			wtf.SetActive(!undress);
		}
		if ((Object)(object)male != (Object)null)
		{
			SkinnedMeshRenderer component = male.GetComponent<SkinnedMeshRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				((Renderer)component).enabled = undress;
			}
			else
			{
				male.SetActive(undress);
			}
		}
		if ((Object)(object)slut_anim != (Object)null)
		{
			slut_anim.SetBool("zxc", undress);
		}
	}

	public bool nude()
	{
		return strip;
	}

	[ServerRpc(RequireOwnership = false)]
	public void RequestStartSexServerRpc(string triggerName)
	{
		start_sex(triggerName);
	}

	public void start_sex(string triggerName)
	{
		if ((Object)(object)slut_anim == (Object)null)
		{
			slut_anim = ((Component)this).GetComponent<Animator>();
			if ((Object)(object)slut_anim == (Object)null)
			{
				slut_anim = ((Component)this).GetComponentInChildren<Animator>();
			}
			if ((Object)(object)slut_anim == (Object)null)
			{
				return;
			}
		}
		bool flag = false;
		AnimatorControllerParameter[] parameters = slut_anim.parameters;
		for (int i = 0; i < parameters.Length; i++)
		{
			if (parameters[i].name == triggerName)
			{
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			return;
		}
		played = true;
		if (lewd(triggerName) || triggerName == "strip_on")
		{
			strip_state(undress: true);
		}
		else if (triggerName == "strip_off")
		{
			strip_state(undress: false);
		}
		float num = length(triggerName);
		if (num <= 0f)
		{
			num = 3f;
		}
		float num2 = 1f;
		if ((Object)(object)maleAnimator != (Object)null)
		{
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				float num3 = male_length(text);
				num2 = ((num3 > 0f) ? (num3 / num) : 1f);
				maleAnimator.speed = num2;
			}
		}
		NetworkAnimator component = ((Component)this).GetComponent<NetworkAnimator>();
		if ((Object)(object)component != (Object)null)
		{
			component.SetTrigger(triggerName);
		}
		else
		{
			slut_anim.SetTrigger(triggerName);
		}
		PlayTriggerClientRpc(triggerName, num2);
		if (animation_coroutine != null)
		{
			((MonoBehaviour)this).StopCoroutine(animation_coroutine);
		}
		animation_coroutine = ((MonoBehaviour)this).StartCoroutine(souls(num + 0.3f));
	}

	[ClientRpc]
	private void PlayTriggerClientRpc(string triggerName, float maleSpeed)
	{
		if ((Object)(object)maleAnimator != (Object)null && maleSpeed > 0f)
		{
			maleAnimator.speed = maleSpeed;
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				NetworkAnimator component = ((Component)maleAnimator).GetComponent<NetworkAnimator>();
				if ((Object)(object)component != (Object)null)
				{
					component.SetTrigger(text);
				}
				else
				{
					maleAnimator.SetTrigger(text);
				}
			}
		}
		if (!((Object)(object)audio_src != (Object)null) || !((Object)(object)LewdCompanionManager.Instance != (Object)null))
		{
			return;
		}
		LewdCompanionManager instance = LewdCompanionManager.Instance;
		if (triggerName.Contains("fast"))
		{
			AudioClip val = instance.pick_sfx("moan");
			if ((Object)(object)val != (Object)null)
			{
				audio_src.PlayOneShot(val);
			}
			AudioClip val2 = instance.pick_sfx("pounding");
			if ((Object)(object)val2 != (Object)null)
			{
				audio_src.PlayOneShot(val2);
			}
		}
		else if (triggerName.Contains("cum"))
		{
			AudioClip val3 = instance.pick_sfx("ahh");
			if ((Object)(object)val3 != (Object)null)
			{
				audio_src.PlayOneShot(val3);
			}
		}
		else if (triggerName.Contains("slow"))
		{
			AudioClip val4 = instance.pick_sfx("moan");
			if ((Object)(object)val4 != (Object)null)
			{
				audio_src.PlayOneShot(val4);
			}
			AudioClip val5 = instance.pick_sfx("slide");
			if ((Object)(object)val5 != (Object)null)
			{
				audio_src.PlayOneShot(val5);
			}
		}
	}

	public void state_idle()
	{
		if ((Object)(object)slut_anim != (Object)null)
		{
			slut_anim.SetTrigger("idle");
		}
		if ((Object)(object)male != (Object)null)
		{
			SkinnedMeshRenderer component = male.GetComponent<SkinnedMeshRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				((Renderer)component).enabled = false;
			}
			else
			{
				male.SetActive(false);
			}
		}
		if ((Object)(object)wtf != (Object)null)
		{
			wtf.SetActive(true);
		}
		strip = false;
		if ((Object)(object)slut_anim != (Object)null)
		{
			slut_anim.SetBool("isUndressed", false);
		}
	}

	private string get_male_trigger(string f)
	{
		if (f.Contains("cowgirl") || f.Contains("facesit"))
		{
			return "facesit_static";
		}
		if (f.Contains("doggy"))
		{
			if (f.Contains("start"))
			{
				return "m_dog_st";
			}
			if (f.Contains("slow"))
			{
				return "m_dog_slow";
			}
			if (f.Contains("fast"))
			{
				return "m_dog_fast";
			}
			if (f.Contains("cum"))
			{
				return "m_dog_cum";
			}
		}
		if (f.Contains("missionary"))
		{
			if (f.Contains("start"))
			{
				return "m_miss_st";
			}
			if (f.Contains("slow"))
			{
				return "m_miss_slow";
			}
			if (f.Contains("fast"))
			{
				return "m_miss_fast";
			}
			if (f.Contains("cum"))
			{
				return "m_miss_cum";
			}
		}
		if (f.Contains("thingjob"))
		{
			if (f.Contains("start"))
			{
				return "m_thing_st";
			}
			if (f.Contains("slow"))
			{
				return "m_thing_slow";
			}
			if (f.Contains("fast"))
			{
				return "m_thing_fast";
			}
			if (f.Contains("cum"))
			{
				return "m_thing_cum";
			}
		}
		return "";
	}

	public float GetFemaleLength(string name)
	{
		return length(name);
	}

	public float GetMaleLength(string name)
	{
		return male_length(name);
	}

	private float length(string triggerName)
	{
		if ((Object)(object)slut_anim == (Object)null || (Object)(object)slut_anim.runtimeAnimatorController == (Object)null)
		{
			return 120f;
		}
		AnimationClip[] animationClips = slut_anim.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(triggerName.ToLower()) || triggerName.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 120f;
	}

	private float male_length(string t)
	{
		if ((Object)(object)maleAnimator == (Object)null || (Object)(object)maleAnimator.runtimeAnimatorController == (Object)null)
		{
			return 0f;
		}
		AnimationClip[] animationClips = maleAnimator.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(t.ToLower()) || t.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 0f;
	}

	private IEnumerator souls(float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		played = false;
		animation_coroutine = null;
	}

	private bool lewd(string triggerName)
	{
		if (!triggerName.Contains("cowgirl") && !triggerName.Contains("facesit") && !triggerName.Contains("doggy") && !triggerName.Contains("missionary"))
		{
			return triggerName.Contains("thingjob");
		}
		return true;
	}
}
[HarmonyPatch]
public static class LewdCompanionEnemyPatch
{
	public class ClubSpawnWatcher : MonoBehaviour
	{
		private float timer;

		private void Update()
		{
			timer += Time.deltaTime;
			if (!(timer < 3f) && !((Object)(object)NetworkManager.Singleton == (Object)null) && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) && !((Object)(object)StartOfRound.Instance == (Object)null) && !((Object)(object)StartOfRound.Instance.currentLevel == (Object)null) && !(StartOfRound.Instance.currentLevel.PlanetName != "71 Gordion"))
			{
				if (club_spawned)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				TrySpawnClub();
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}

	public class warn : MonoBehaviour
	{
		public IEnumerator DelayedShow(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			sh_warning();
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__24_0;

		public static UnityAction <>9__24_1;

		public static UnityAction <>9__24_2;

		public static Func<SpawnableEnemyWithRarity, bool> <>9__28_0;

		public static Func<EnemyAI, bool> <>9__30_0;

		internal void <add_warning>b__24_0()
		{
			age_false();
		}

		internal void <add_warning>b__24_1()
		{
			age_false();
		}

		internal void <add_warning>b__24_2()
		{
			age_true();
		}

		internal bool <slut_onlvl>b__28_0(SpawnableEnemyWithRarity e)
		{
			return (Object)(object)e.enemyType == (Object)(object)slut_type;
		}

		internal bool <spawn_on_state>b__30_0(EnemyAI e)
		{
			return (Object)(object)e.enemyType == (Object)(object)slut_type;
		}
	}

	private static bool reg;

	private static EnemyType slut_type;

	private static bool club_spawned;

	private static GameObject club_prefab_cache;

	private static GameObject warning;

	private static bool warn_showed;

	private static bool ass;

	private static GameObject bracken_prefab_cache;

	private static bool subscribed;

	public static GameObject SlutEnemyPrefab
	{
		get
		{
			if (!((Object)(object)slut_type != (Object)null))
			{
				return null;
			}
			return slut_type.enemyPrefab;
		}
	}

	public static GameObject ClubPrefab => club_prefab_cache;

	public static GameObject BrackenPrefab => bracken_prefab_cache;

	[HarmonyPatch(typeof(GameNetworkManager), "Start")]
	[HarmonyPostfix]
	private static void LoadEnemyType()
	{
		//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)
		if ((Object)(object)global::LewdCompany.LewdCompany.bundle == (Object)null)
		{
			Debug.LogError((object)"no bundle");
			return;
		}
		Scene activeScene = SceneManager.GetActiveScene();
		string name = ((Scene)(ref activeScene)).name;
		Debug.Log((object)("current scen " + name));
		if ((Object)(object)warning == (Object)null)
		{
			add_warning();
		}
		if (name == "MainMenu")
		{
			if (!warn_showed)
			{
				warn_show(0.5f);
			}
		}
		else if ((Object)(object)warning != (Object)null)
		{
			warning.SetActive(false);
		}
		fkc_test_method();
		cache_bracken();
		cache_club();
		NetworkSpawnHelper.EnsureRegistered();
		if (!subscribed)
		{
			subscribed = true;
			SceneManager.sceneLoaded += OnSceneLoadedEvent;
			Debug.Log((object)"sceneLoaded subscribed");
		}
	}

	private static void OnSceneLoadedEvent(Scene scene, LoadSceneMode mode)
	{
		//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_00eb: Expected O, but got Unknown
		string name = ((Scene)(ref scene)).name;
		Debug.Log((object)("event scen loaded " + name));
		if (name == "InitScene")
		{
			if ((Object)(object)warning == (Object)null)
			{
				add_warning();
			}
			if (!ass && !warn_showed)
			{
				ass = true;
				warn_show(3.7f);
			}
			return;
		}
		if (name == "MainMenu")
		{
			if ((Object)(object)warning == (Object)null)
			{
				add_warning();
			}
			if (!warn_showed)
			{
				warn_show(0.5f);
			}
			return;
		}
		if ((Object)(object)warning != (Object)null)
		{
			warning.SetActive(false);
			warn_showed = false;
		}
		if (name == "CompanyBuilding" && !club_spawned && (Object)(object)GameObject.Find("--manager--") == (Object)null)
		{
			Debug.Log((object)"--manager--");
			GameObject val = new GameObject("--manager--");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<ClubSpawnWatcher>();
		}
	}

	public static void TrySpawnClub()
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkSpawnHelper.IsServerOrHost() || (Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.currentLevel == (Object)null || StartOfRound.Instance.currentLevel.PlanetName != "71 Gordion")
		{
			return;
		}
		if (club_spawned)
		{
			Debug.Log((object)"club already spawned");
			return;
		}
		cache_club();
		if ((Object)(object)club_prefab_cache == (Object)null)
		{
			Debug.LogError((object)"stripclub_pref not found");
			return;
		}
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(-15.22f, -2.49f, -90.1f);
		NetworkObject val2 = NetworkSpawnHelper.SpawnNetworked(club_prefab_cache, val, Quaternion.identity);
		if ((Object)(object)val2 == (Object)null)
		{
			Debug.LogError((object)"stripclub spawn failed");
			return;
		}
		Debug.Log((object)$"stripclub spawned at {val}");
		club_spawned = true;
		spawn_girls_from_club(((Component)val2).gameObject);
	}

	private static void warn_show(float delay)
	{
		//IL_0013: 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_001e: Expected O, but got Unknown
		if (!((Object)(object)warning == (Object)null))
		{
			GameObject val = new GameObject("Warning");
			Object.DontDestroyOnLoad((Object)val);
			warn warn = val.AddComponent<warn>();
			((MonoBehaviour)warn).StartCoroutine(warn.DelayedShow(delay));
		}
	}

	private static void cache_bracken()
	{
		if (!((Object)(object)bracken_prefab_cache != (Object)null))
		{
			bracken_prefab_cache = global::LewdCompany.LewdCompany.bracken_prefab;
			if ((Object)(object)bracken_prefab_cache != (Object)null)
			{
				Debug.Log((object)"bracken cached");
			}
			else
			{
				Debug.LogError((object)"bracken prefab not found (is it loaded in LewdCompany?)");
			}
		}
	}

	private static void cache_club()
	{
		if (!((Object)(object)club_prefab_cache != (Object)null) && !((Object)(object)global::LewdCompany.LewdCompany.bundle == (Object)null))
		{
			club_prefab_cache = global::LewdCompany.LewdCompany.bundle.LoadAsset<GameObject>("stripclub_pref");
			if ((Object)(object)club_prefab_cache != (Object)null)
			{
				Debug.Log((object)"club cached");
			}
			else
			{
				Debug.LogError((object)"club prefab not found");
			}
		}
	}

	private static void fkc_test_method()
	{
		if (!reg && !((Object)(object)global::LewdCompany.LewdCompany.bundle == (Object)null))
		{
			slut_type = global::LewdCompany.LewdCompany.bundle.LoadAsset<EnemyType>("Sexness");
			if (!((Object)(object)slut_type == (Object)null))
			{
				reg = true;
				Debug.Log((object)"e.t loaded");
			}
		}
	}

	public static void add_warning()
	{
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Expected O, but got Unknown
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Expected O, but got Unknown
		if ((Object)(object)global::LewdCompany.LewdCompany.bundle == (Object)null || (Object)(object)warning != (Object)null)
		{
			return;
		}
		try
		{
			warning = global::LewdCompany.LewdCompany.bundle.LoadAsset<GameObject>("Warning");
			if ((Object)(object)warning == (Object)null)
			{
				return;
			}
			warning = Object.Instantiate<GameObject>(warning);
			warning.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)warning);
			Transform val = warning.transform.Find("no");
			if ((Object)(object)val != (Object)null)
			{
				Button component = ((Component)val).GetComponent<Button>();
				if ((Object)(object)component != (Object)null)
				{
					ButtonClickedEvent onClick = component.onClick;
					object obj = <>c.<>9__24_0;
					if (obj == null)
					{
						UnityAction val2 = delegate
						{
							age_false();
						};
						<>c.<>9__24_0 = val2;
						obj = (object)val2;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj);
				}
			}
			else
			{
				Button[] componentsInChildren = warning.GetComponentsInChildren<Button>();
				foreach (Button val3 in componentsInChildren)
				{
					Text componentInChildren = ((Component)val3).GetComponentInChildren<Text>();
					if (!((Object)(object)componentInChildren != (Object)null) || !(componentInChildren.text.ToLower() == "no"))
					{
						continue;
					}
					ButtonClickedEvent onClick2 = val3.onClick;
					object obj2 = <>c.<>9__24_1;
					if (obj2 == null)
					{
						UnityAction val4 = delegate
						{
							age_false();
						};
						<>c.<>9__24_1 = val4;
						obj2 = (object)val4;
					}
					((UnityEvent)onClick2).AddListener((UnityAction)obj2);
					break;
				}
			}
			Transform val5 = warning.transform.Find("yes");
			if (!((Object)(object)val5 != (Object)null))
			{
				return;
			}
			Button component2 = ((Component)val5).GetComponent<Button>();
			if (!((Object)(object)component2 != (Object)null))
			{
				return;
			}
			ButtonClickedEvent onClick3 = component2.onClick;
			object obj3 = <>c.<>9__24_2;
			if (obj3 == null)
			{
				UnityAction val6 = delegate
				{
					age_true();
				};
				<>c.<>9__24_2 = val6;
				obj3 = (object)val6;
			}
			((UnityEvent)onClick3).AddListener((UnityAction)obj3);
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("err " + ex.Message));
		}
	}

	public static void sh_warning()
	{
		if ((Object)(object)warning != (Object)null)
		{
			warning.SetActive(true);
			warn_showed = true;
		}
	}

	public static void age_true()
	{
		PlayerPrefs.SetInt("verify", 1);
		PlayerPrefs.Save();
		if ((Object)(object)warning != (Object)null)
		{
			warn_showed = false;
		}
		fkc_test_method();
	}

	public static void age_false()
	{
		Debug.Log((object)"goodbye :-)");
		string directoryName = Path.GetDirectoryName(typeof(LewdCompanionEnemyPatch).Assembly.Location);
		try
		{
			string[] files = Directory.GetFiles(directoryName, "*.dll");
			foreach (string text in files)
			{
				if (text.Contains("LewdCompany"))
				{
					try
					{
						File.Delete(text);
					}
					catch
					{
					}
				}
			}
		}
		catch
		{
		}
		Application.Quit();
		Process.GetCurrentProcess().Kill();
	}

	[HarmonyPatch(typeof(RoundManager), "Start")]
	[HarmonyPostfix]
	private static void slut_onlvl()
	{
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Expected O, but got Unknown
		if (!PlayerPrefs.HasKey("verify") || !reg || (Object)(object)slut_type == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null)
		{
			return;
		}
		SelectableLevel[] levels = StartOfRound.Instance.levels;
		foreach (SelectableLevel val in levels)
		{
			if (!((Object)(object)val == (Object)null) && !val.Enemies.Any((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)slut_type))
			{
				val.Enemies.Add(new SpawnableEnemyWithRarity(slut_type, 1));
				Debug.Log((object)("load - " + ((Object)val).name));
			}
		}
	}

	private static Vector3 sp_ship()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: 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)
		GameObject val = GameObject.Find("PlayerShipNavmesh");
		if ((Object)(object)val == (Object)null)
		{
			return new Vector3(0f, 2f, 5f);
		}
		return val.transform.position + new Vector3(20f, -5.4f, 2.3f);
	}

	[HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")]
	[HarmonyPostfix]
	private static void spawn_on_state()
	{
		//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_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: 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_0106: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkSpawnHelper.IsServerOrHost() || !PlayerPrefs.HasKey("verify") || !reg || (Object)(object)slut_type == (Object)null || (Object)(object)RoundManager.Instance == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.currentLevel == (Object)null || StartOfRound.Instance.currentLevel.PlanetName != "71 Gordion" || RoundManager.Instance.SpawnedEnemies.Any((EnemyAI e) => (Object)(object)e.enemyType == (Object)(object)slut_type))
		{
			return;
		}
		Vector3 val = sp_ship();
		if ((Object)(object)NetworkSpawnHelper.SpawnNetworked(slut_type.enemyPrefab, val, Quaternion.identity) == (Object)null)
		{
			Debug.LogError((object)"companion spawn failed");
			return;
		}
		cache_bracken();
		if ((Object)(object)bracken_prefab_cache != (Object)null)
		{
			Vector3 pos = val + new Vector3(2f, 0f, 0f);
			if ((Object)(object)NetworkSpawnHelper.SpawnNetworked(bracken_prefab_cache, pos, Quaternion.identity) == (Object)null)
			{
				Debug.LogError((object)"bracken spawn failed");
			}
		}
	}

	private static void spawn_girls_from_club(GameObject club)
	{
		//IL_007c: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: 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_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: 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_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: 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)club == (Object)null))
		{
			Transform val = FindChildByName(club.transform, "s_1");
			Transform val2 = FindChildByName(club.transform, "s_2");
			Transform val3 = FindChildByName(club.transform, "s_3");
			Transform val4 = FindChildByName(club.transform, "s_4");
			if ((Object)(object)bracken_prefab_cache == (Object)null)
			{
				cache_bracken();
			}
			if ((Object)(object)bracken_prefab_cache != (Object)null && (Object)(object)val != (Object)null && (Object)(object)NetworkSpawnHelper.SpawnNetworked(bracken_prefab_cache, val.position, val.rotation) != (Object)null)
			{
				Debug.Log((object)$"bracken spawned at {val.position}");
			}
			if ((Object)(object)global::LewdCompany.LewdCompany.yipee_prefab != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)NetworkSpawnHelper.SpawnNetworked(global::LewdCompany.LewdCompany.yipee_prefab, val2.position, val2.rotation) != (Object)null)
			{
				Debug.Log((object)$"yipee spawned at {val2.position}");
			}
			if ((Object)(object)global::LewdCompany.LewdCompany.slut != (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)NetworkSpawnHelper.SpawnNetworked(global::LewdCompany.LewdCompany.slut, val3.position, val3.rotation) != (Object)null)
			{
				Debug.Log((object)$"companion spawned at {val3.position}");
			}
			if ((Object)(object)global::LewdCompany.LewdCompany.puppet_prefab != (Object)null && (Object)(object)val4 != (Object)null && (Object)(object)NetworkSpawnHelper.SpawnNetworked(global::LewdCompany.LewdCompany.puppet_prefab, val4.position, val4.rotation) != (Object)null)
			{
				Debug.Log((object)$"puppet spawned at {val4.position}");
			}
		}
	}

	private static Transform FindChildByName(Transform root, string name)
	{
		Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == name)
			{
				return val;
			}
		}
		return null;
	}
}
public class PuppetAI : NetworkBehaviour
{
	private PlayerControllerB targetPlayer;

	private Animator puppet_anim;

	private Animator maleAnimator;

	private GameObject male;

	private GameObject futa;

	private bool played;

	private Coroutine animation_coroutine;

	private AudioSource audio_src;

	public override void OnNetworkSpawn()
	{
		((NetworkBehaviour)this).OnNetworkSpawn();
		if ((Object)(object)((Component)this).GetComponent<PuppetInteraction>() == (Object)null)
		{
			((Component)this).gameObject.AddComponent<PuppetInteraction>();
		}
		puppet_anim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)puppet_anim == (Object)null)
		{
			puppet_anim = ((Component)this).GetComponentInChildren<Animator>();
		}
		if ((Object)(object)puppet_anim != (Object)null)
		{
			puppet_anim.SetTrigger("idle");
		}
		male = null;
		maleAnimator = null;
		futa = null;
		Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == "man_mesh")
			{
				male = ((Component)val).gameObject;
				maleAnimator = ((Component)val).GetComponent<Animator>();
				if ((Object)(object)maleAnimator == (Object)null)
				{
					maleAnimator = ((Component)val).GetComponentInChildren<Animator>();
				}
			}
			else if (((Object)val).name == "Futa")
			{
				futa = ((Component)val).gameObject;
			}
		}
		if ((Object)(object)male == (Object)null)
		{
			SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val2 in componentsInChildren2)
			{
				string text = ((Object)val2).name.ToLower();
				if (text.Contains("man") || text.Contains("male"))
				{
					male = ((Component)val2).gameObject;
					maleAnimator = ((Component)val2).GetComponent<Animator>();
					if ((Object)(object)maleAnimator == (Object)null)
					{
						maleAnimator = ((Component)val2).GetComponentInChildren<Animator>();
					}
					break;
				}
			}
		}
		audio_src = ((Component)this).GetComponent<AudioSource>();
		if ((Object)(object)audio_src == (Object)null)
		{
			audio_src = ((Component)this).gameObject.AddComponent<AudioSource>();
		}
		audio_src.spatialBlend = 1f;
		audio_src.minDistance = 2f;
		audio_src.maxDistance = 20f;
		audio_src.playOnAwake = false;
		audio_src.loop = false;
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(false);
		}
		if ((Object)(object)futa != (Object)null)
		{
			futa.SetActive(false);
		}
		target_player();
	}

	private void Update()
	{
		if (!played && (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost) && (Object)(object)targetPlayer == (Object)null)
		{
			target_player();
		}
	}

	private void target_player()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		float num = float.MaxValue;
		PlayerControllerB val = null;
		if ((Object)(object)StartOfRound.Instance != (Object)null)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if ((Object)(object)val2 != (Object)null && val2.isPlayerControlled && !val2.isPlayerDead)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = val2;
					}
				}
			}
		}
		targetPlayer = val;
	}

	public void strip_state(bool show)
	{
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(show);
		}
		if ((Object)(object)futa != (Object)null)
		{
			futa.SetActive(show && PuppetConfig.Futa);
		}
	}

	public bool nude()
	{
		return true;
	}

	[ServerRpc(RequireOwnership = false)]
	public void RequestStartSexServerRpc(string triggerName)
	{
		start_sex(triggerName);
	}

	public void start_sex(string triggerName)
	{
		if ((Object)(object)puppet_anim == (Object)null)
		{
			return;
		}
		bool flag = false;
		AnimatorControllerParameter[] parameters = puppet_anim.parameters;
		for (int i = 0; i < parameters.Length; i++)
		{
			if (parameters[i].name == triggerName)
			{
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			return;
		}
		played = true;
		if (lewd(triggerName))
		{
			strip_state(show: true);
		}
		float num = length(triggerName);
		if (num <= 0f)
		{
			num = 3f;
		}
		float num2 = 1f;
		if ((Object)(object)maleAnimator != (Object)null)
		{
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				float num3 = male_length(text);
				num2 = ((num3 > 0f) ? (num3 / num) : 1f);
				maleAnimator.speed = num2;
			}
		}
		puppet_anim.SetTrigger(triggerName);
		PlayTriggerClientRpc(triggerName, num2);
		if (animation_coroutine != null)
		{
			((MonoBehaviour)this).StopCoroutine(animation_coroutine);
		}
		animation_coroutine = ((MonoBehaviour)this).StartCoroutine(souls(num + 0.3f));
	}

	[ClientRpc]
	private void PlayTriggerClientRpc(string triggerName, float maleSpeed)
	{
		if ((Object)(object)puppet_anim != (Object)null)
		{
			puppet_anim.SetTrigger(triggerName);
		}
		if (lewd(triggerName))
		{
			if ((Object)(object)male != (Object)null)
			{
				male.SetActive(true);
			}
			if ((Object)(object)futa != (Object)null)
			{
				futa.SetActive(PuppetConfig.Futa);
			}
		}
		if ((Object)(object)maleAnimator != (Object)null && maleSpeed > 0f)
		{
			maleAnimator.speed = maleSpeed;
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				maleAnimator.SetTrigger(text);
			}
		}
		if (!((Object)(object)audio_src != (Object)null) || !((Object)(object)LewdCompanionManager.Instance != (Object)null))
		{
			return;
		}
		LewdCompanionManager instance = LewdCompanionManager.Instance;
		if (triggerName.Contains("fast"))
		{
			AudioClip val = instance.pick_sfx("moan");
			if ((Object)(object)val != (Object)null)
			{
				audio_src.PlayOneShot(val);
			}
			AudioClip val2 = instance.pick_sfx("pounding");
			if ((Object)(object)val2 != (Object)null)
			{
				audio_src.PlayOneShot(val2);
			}
		}
		else if (triggerName.Contains("cum"))
		{
			AudioClip val3 = instance.pick_sfx("ahh");
			if ((Object)(object)val3 != (Object)null)
			{
				audio_src.PlayOneShot(val3);
			}
		}
		else if (triggerName.Contains("slow"))
		{
			AudioClip val4 = instance.pick_sfx("moan");
			if ((Object)(object)val4 != (Object)null)
			{
				audio_src.PlayOneShot(val4);
			}
			AudioClip val5 = instance.pick_sfx("slide");
			if ((Object)(object)val5 != (Object)null)
			{
				audio_src.PlayOneShot(val5);
			}
		}
	}

	public void state_idle()
	{
		if ((Object)(object)puppet_anim != (Object)null)
		{
			puppet_anim.SetTrigger("idle");
		}
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(false);
		}
		if ((Object)(object)futa != (Object)null)
		{
			futa.SetActive(false);
		}
	}

	private string get_male_trigger(string f)
	{
		if (f.Contains("pr"))
		{
			if (f.Contains("fast"))
			{
				return "Puppet_pr_fast_m";
			}
			return "Puppet_pr_slowm_m";
		}
		if (f.Contains("sd"))
		{
			if (f.Contains("slow"))
			{
				return "Puppet_sd_slow_m";
			}
			if (f.Contains("fast"))
			{
				return "Puppet_sd_fast_m";
			}
		}
		return "";
	}

	public float GetFemaleLength(string name)
	{
		return length(name);
	}

	public float GetMaleLength(string name)
	{
		return male_length(name);
	}

	private float length(string t)
	{
		if ((Object)(object)puppet_anim == (Object)null || (Object)(object)puppet_anim.runtimeAnimatorController == (Object)null)
		{
			return 120f;
		}
		AnimationClip[] animationClips = puppet_anim.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(t.ToLower()) || t.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 120f;
	}

	private float male_length(string t)
	{
		if ((Object)(object)maleAnimator == (Object)null || (Object)(object)maleAnimator.runtimeAnimatorController == (Object)null)
		{
			return 0f;
		}
		AnimationClip[] animationClips = maleAnimator.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(t.ToLower()) || t.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 0f;
	}

	private IEnumerator souls(float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		played = false;
		animation_coroutine = null;
	}

	private bool lewd(string t)
	{
		if (!t.Contains("pr"))
		{
			return t.Contains("sd");
		}
		return true;
	}
}
public class Yipee : NetworkBehaviour
{
	private PlayerControllerB targetPlayer;

	private Animator yipee_anim;

	private Animator maleAnimator;

	private GameObject male;

	private bool played;

	private Coroutine animation_coroutine;

	private AudioSource audio_src;

	public override void OnNetworkSpawn()
	{
		((NetworkBehaviour)this).OnNetworkSpawn();
		if ((Object)(object)((Component)this).GetComponent<YipeeInteraction>() == (Object)null)
		{
			((Component)this).gameObject.AddComponent<YipeeInteraction>();
		}
		yipee_anim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)yipee_anim == (Object)null)
		{
			yipee_anim = ((Component)this).GetComponentInChildren<Animator>();
		}
		if ((Object)(object)yipee_anim != (Object)null)
		{
			yipee_anim.SetTrigger("idle");
		}
		male = null;
		maleAnimator = null;
		Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == "man_mesh")
			{
				male = ((Component)val).gameObject;
				maleAnimator = ((Component)val).GetComponent<Animator>();
				if ((Object)(object)maleAnimator == (Object)null)
				{
					maleAnimator = ((Component)val).GetComponentInChildren<Animator>();
				}
			}
		}
		if ((Object)(object)male == (Object)null)
		{
			SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val2 in componentsInChildren2)
			{
				string text = ((Object)val2).name.ToLower();
				if (text.Contains("man") || text.Contains("male"))
				{
					male = ((Component)val2).gameObject;
					maleAnimator = ((Component)val2).GetComponent<Animator>();
					if ((Object)(object)maleAnimator == (Object)null)
					{
						maleAnimator = ((Component)val2).GetComponentInChildren<Animator>();
					}
					break;
				}
			}
		}
		audio_src = ((Component)this).GetComponent<AudioSource>();
		if ((Object)(object)audio_src == (Object)null)
		{
			audio_src = ((Component)this).gameObject.AddComponent<AudioSource>();
		}
		audio_src.spatialBlend = 1f;
		audio_src.minDistance = 2f;
		audio_src.maxDistance = 20f;
		audio_src.playOnAwake = false;
		audio_src.loop = false;
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(false);
		}
		target_player();
	}

	private void Update()
	{
		//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)
		//IL_0069: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		if (played || (!((NetworkBehaviour)this).IsServer && !((NetworkBehaviour)this).IsHost))
		{
			return;
		}
		if ((Object)(object)targetPlayer == (Object)null)
		{
			target_player();
		}
		else if (targetPlayer.isPlayerControlled && !targetPlayer.isPlayerDead)
		{
			Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position;
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude > 0.1f)
			{
				Quaternion val2 = Quaternion.LookRotation(val);
				((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 5f);
			}
		}
	}

	private void target_player()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		float num = float.MaxValue;
		PlayerControllerB val = null;
		if ((Object)(object)StartOfRound.Instance != (Object)null)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if ((Object)(object)val2 != (Object)null && val2.isPlayerControlled && !val2.isPlayerDead)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = val2;
					}
				}
			}
		}
		targetPlayer = val;
	}

	public void strip_state(bool show)
	{
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(show);
		}
	}

	public bool nude()
	{
		return true;
	}

	[ServerRpc(RequireOwnership = false)]
	public void RequestStartSexServerRpc(string triggerName)
	{
		start_sex(triggerName);
	}

	public void start_sex(string triggerName)
	{
		if ((Object)(object)yipee_anim == (Object)null)
		{
			return;
		}
		bool flag = false;
		AnimatorControllerParameter[] parameters = yipee_anim.parameters;
		for (int i = 0; i < parameters.Length; i++)
		{
			if (parameters[i].name == triggerName)
			{
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			return;
		}
		played = true;
		if (lewd(triggerName))
		{
			strip_state(show: true);
		}
		float num = length(triggerName);
		if (num <= 0f)
		{
			num = 3f;
		}
		float num2 = 1f;
		if ((Object)(object)maleAnimator != (Object)null)
		{
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				float num3 = male_length(text);
				num2 = ((num3 > 0f) ? (num3 / num) : 1f);
				maleAnimator.speed = num2;
			}
		}
		yipee_anim.SetTrigger(triggerName);
		PlayTriggerClientRpc(triggerName, num2);
		if (animation_coroutine != null)
		{
			((MonoBehaviour)this).StopCoroutine(animation_coroutine);
		}
		animation_coroutine = ((MonoBehaviour)this).StartCoroutine(souls(num + 0.3f));
	}

	[ClientRpc]
	private void PlayTriggerClientRpc(string triggerName, float maleSpeed)
	{
		if ((Object)(object)yipee_anim != (Object)null)
		{
			yipee_anim.SetTrigger(triggerName);
		}
		if (lewd(triggerName) && (Object)(object)male != (Object)null)
		{
			male.SetActive(true);
		}
		if ((Object)(object)maleAnimator != (Object)null && maleSpeed > 0f)
		{
			maleAnimator.speed = maleSpeed;
			string text = get_male_trigger(triggerName);
			if (!string.IsNullOrEmpty(text))
			{
				maleAnimator.SetTrigger(text);
			}
		}
		if (!((Object)(object)audio_src != (Object)null) || !((Object)(object)LewdCompanionManager.Instance != (Object)null))
		{
			return;
		}
		LewdCompanionManager instance = LewdCompanionManager.Instance;
		if (triggerName.Contains("fast"))
		{
			AudioClip val = instance.pick_sfx("moan");
			if ((Object)(object)val != (Object)null)
			{
				audio_src.PlayOneShot(val);
			}
			AudioClip val2 = instance.pick_sfx("pounding");
			if ((Object)(object)val2 != (Object)null)
			{
				audio_src.PlayOneShot(val2);
			}
		}
		else if (triggerName.Contains("cum"))
		{
			AudioClip val3 = instance.pick_sfx("ahh");
			if ((Object)(object)val3 != (Object)null)
			{
				audio_src.PlayOneShot(val3);
			}
		}
		else if (triggerName.Contains("slow"))
		{
			AudioClip val4 = instance.pick_sfx("moan");
			if ((Object)(object)val4 != (Object)null)
			{
				audio_src.PlayOneShot(val4);
			}
			AudioClip val5 = instance.pick_sfx("slide");
			if ((Object)(object)val5 != (Object)null)
			{
				audio_src.PlayOneShot(val5);
			}
		}
	}

	public void state_idle()
	{
		if ((Object)(object)yipee_anim != (Object)null)
		{
			yipee_anim.SetTrigger("idle");
		}
		if ((Object)(object)male != (Object)null)
		{
			male.SetActive(false);
		}
	}

	private string get_male_trigger(string f)
	{
		if (f.Contains("backcow"))
		{
			if (f.Contains("start"))
			{
				return "m_y_cowback_start";
			}
			if (f.Contains("slow"))
			{
				return "m_y_cowback_slow";
			}
			if (f.Contains("fast"))
			{
				return "m_y_cowback_fast";
			}
			if (f.Contains("cum"))
			{
				return "m_y_cowback_cum";
			}
		}
		if (f.Contains("blowjob"))
		{
			if (f.Contains("start"))
			{
				return "m_y_blow_start";
			}
			if (f.Contains("slow"))
			{
				return "m_y_blow_slow";
			}
			if (f.Contains("fast"))
			{
				return "m_y_blow_fast";
			}
			if (f.Contains("cum"))
			{
				return "m_y_blow_cum";
			}
		}
		if (f.Contains("paizuri"))
		{
			if (f.Contains("slow"))
			{
				return "m_y_paizuri_slow";
			}
			if (f.Contains("fast"))
			{
				return "m_y_paizuri_fast";
			}
			if (f.Contains("cum"))
			{
				return "m_y_paizuri_cum";
			}
		}
		return "";
	}

	public float GetFemaleLength(string name)
	{
		return length(name);
	}

	public float GetMaleLength(string name)
	{
		return male_length(name);
	}

	private float length(string t)
	{
		if ((Object)(object)yipee_anim == (Object)null || (Object)(object)yipee_anim.runtimeAnimatorController == (Object)null)
		{
			return 120f;
		}
		AnimationClip[] animationClips = yipee_anim.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(t.ToLower()) || t.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 120f;
	}

	private float male_length(string t)
	{
		if ((Object)(object)maleAnimator == (Object)null || (Object)(object)maleAnimator.runtimeAnimatorController == (Object)null)
		{
			return 0f;
		}
		AnimationClip[] animationClips = maleAnimator.runtimeAnimatorController.animationClips;
		foreach (AnimationClip val in animationClips)
		{
			if (((Object)val).name.ToLower().Contains(t.ToLower()) || t.ToLower().Contains(((Object)val).name.ToLower()))
			{
				return val.length;
			}
		}
		return 0f;
	}

	private IEnumerator souls(float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		played = false;
		animation_coroutine = null;
	}

	private bool lewd(string t)
	{
		if (!t.Contains("backcow") && !t.Contains("blowjob"))
		{
			return t.Contains("paizuri");
		}
		return true;
	}
}
namespace LewdCompany;

public class BrackenInteraction : MonoBehaviour
{
	private bool ins;

	private bool interact;

	private void Start()
	{
		Collider component = ((Component)this).GetComponent<Collider>();
		if ((Object)(object)component == (Object)null)
		{
			Debug.LogWarning((object)"[LewdCompany] bracken interaction: no collider");
			return;
		}
		if (!component.isTrigger)
		{
			component.isTrigger = true;
		}
		interact = true;
	}

	private void OnTriggerEnter(Collider other)
	{
		if ((Object)(object)((Component)other).GetComponentInParent<PlayerControllerB>() != (Object)null)
		{
			ins = true;
			Debug.Log((object)"[LewdCompany] bracken trigger enter");
		}
	}

	private void OnTriggerExit(Collider other)
	{
		if ((Object)(object)((Component)other).GetComponentInParent<PlayerControllerB>() != (Object)null)
		{
			ins = false;
			Debug.Log((object)"[LewdCompany] bracken trigger exit");
		}
	}

	private void Update()
	{
		if (interact && ins && Keyboard.current != null && ((ButtonControl)Keyboard.current.eKey).wasPressedThisFrame)
		{
			op_menu();
		}
		if (Keyboard.current != null && ((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame && (Object)(object)BrackenManager.Instance != (Object)null)
		{
			BrackenManager.Instance.toggle_men(open: false);
		}
	}

	private void op_menu()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		if ((Object)(object)BrackenManager.Instance == (Object)null && (Object)(object)Object.FindObjectOfType<BrackenManager>() == (Object)null)
		{
			GameObject val = new GameObject("BrackenManager");
			val.AddComponent<BrackenManager>();
			Object.DontDestroyOnLoad((Object)val);
		}
		if ((Object)(object)BrackenManager.Instance != (Object)null)
		{
			BrackenManager.Instance.toggle_men(open: true);
		}
	}
}
public class BrackenManager : MonoBehaviour
{
	private PlayerControllerB p_l;

	private GameObject bracken;

	private Animator bracken_anim;

	private Animator male_animator;

	private GameObject ui_pan;

	private Animator uiAnimator;

	private bool ui_opened;

	private bool search;

	private bool nevermore;

	private Camera main_camera;

	private GameObject camPiv;

	private Camera bracken_camera;

	private bool bracken_act;

	private float pivoty;

	private float pivotx;

	private bool shift;

	private bool cumming;

	private string current_pose = "";

	public static BrackenManager Instance { get; private set; }

	private void Awake()
	{
		if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		Instance = this;
		LewdCompany.Log.LogInfo((object)"bracken instance");
		Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		SceneManager.sceneLoaded += OnSceneLoaded;
		ui_ftp();
	}

	private void Start()
	{
		LewdCompany.Log.LogInfo((object)"bracken compl");
		((MonoBehaviour)this).StartCoroutine(main());
		cam_find();
	}

	private void cam_find()
	{
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Expected O, but got Unknown
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		main_camera = Camera.main;
		if ((Object)(object)main_camera == (Object)null)
		{
			main_camera = Object.FindObjectOfType<Camera>();
		}
		if ((Object)(object)bracken == (Object)null)
		{
			LewdCompany.Log.LogWarning((object)"bracken cam_find: bracken NULL");
			return;
		}
		Transform val = null;
		Transform[] componentsInChildren = bracken.GetComponentsInChildren<Transform>(true);
		foreach (Transform val2 in componentsInChildren)
		{
			if (((Object)val2).name == "CamPiv")
			{
				val = val2;
				break;
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			LewdCompany.Log.LogWarning((object)"bracken cam_find: CamPiv NOT FOUND");
			return;
		}
		camPiv = ((Component)val).gameObject;
		bracken_camera = camPiv.GetComponentInChildren<Camera>();
		if ((Object)(object)bracken_camera == (Object)null)
		{
			GameObject val3 = new GameObject("BrackenCam");
			val3.transform.parent = camPiv.transform;
			val3.transform.localPosition = Vector3.zero;
			val3.transform.localRotation = Quaternion.identity;
			bracken_camera = val3.AddComponent<Camera>();
		}
		((Behaviour)bracken_camera).enabled = false;
		LewdCompany.Log.LogInfo((object)"bracken cam found");
	}

	private IEnumerator main()
	{
		yield return (object)new WaitForSeconds(1f);
		find_bracken();
		api_male();
		if (!nevermore)
		{
			ui_ass();
			nevermore = true;
		}
		cam_find();
	}

	private void api_male()
	{
		if ((Object)(object)bracken == (Object)null)
		{
			return;
		}
		Transform[] componentsInChildren = bracken.GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == "man_mesh")
			{
				male_animator = ((Component)val).GetComponent<Animator>();
				if ((Object)(object)male_animator == (Object)null)
				{
					male_animator = ((Component)val).GetComponentInChildren<Animator>();
				}
				LewdCompany.Log.LogInfo((object)"bracken male fucked up");
				return;
			}
		}
		LewdCompany.Log.LogWarning((object)"bracken male bruh");
	}

	private void Update()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
		if (Keyboard.current == null)
		{
			return;
		}
		if (bracken_act)
		{
			if (Mouse.current != null)
			{
				Vector2 val = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).delta).ReadValue();
				if (Mouse.current.leftButton.isPressed)
				{
					pivoty += val.x * 0.5f;
					pivotx += val.y * 0.5f;
					pivotx = Mathf.Clamp(pivotx, -80f, 80f);
					if ((Object)(object)camPiv != (Object)null)
					{
						camPiv.transform.localRotation = Quaternion.Euler(pivotx, pivoty, 0f);
					}
				}
				float y = ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y;
				if (y != 0f && (Object)(object)bracken_camera != (Object)null)
				{
					float num = bracken_camera.fieldOfView - y * 5f;
					bracken_camera.fieldOfView = Mathf.Clamp(num, 20f, 100f);
				}
			}
			bool flag = ((ButtonControl)Keyboard.current.leftShiftKey).isPressed || ((ButtonControl)Keyboard.current.rightShiftKey).isPressed;
			if (flag && !shift && (Object)(object)bracken != (Object)null && !string.IsNullOrEmpty(current_pose))
			{
				string femaleTrigger = "b_" + current_pose + "_fast";
				string maleTrigger = get_male_trigger(current_pose, "fast");
				zxc_da(femaleTrigger, maleTrigger);
			}
			shift = flag;
			bool isPressed = ((ButtonControl)Keyboard.current.spaceKey).isPressed;
			if (isPressed && !cumming && !string.IsNullOrEmpty(current_pose))
			{
				string femaleTrigger2 = "b_" + current_pose + "_cum";
				string maleTrigger2 = get_male_trigger(current_pose, "cum");
				zxc_da(femaleTrigger2, maleTrigger2);
			}
			cumming = isPressed;
			if (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame)
			{
				astral_step();
			}
		}
		if (((ButtonControl)Keyboard.current.f1Key).wasPressedThisFrame)
		{
			toggle_men(!ui_opened);
		}
		if (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame && ui_opened)
		{
			toggle_men(open: false);
		}
	}

	private string get_male_trigger(string pose, string stage)
	{
		switch (pose)
		{
		case "handjob":
			return "m_handjob_static";
		case "paizuri":
			return "m_paizuri_static";
		case "doggy":
			switch (stage)
			{
			case "start":
				return "m_doggy_br_start";
			case "slow":
				return "m_doggy_br_slow";
			case "fast":
				return "m_doggy_br_fast";
			case "cum":
				return "m_doggy_br_cum";
			}
			break;
		}
		return "m_handjob_static";
	}

	private void bracken_cam()
	{
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		LewdCompany.Log.LogInfo((object)$"bracken_cam called, bracken_camera null? {(Object)(object)bracken_camera == (Object)null}");
		if ((Object)(object)bracken_camera == (Object)null)
		{
			cam_find();
			if ((Object)(object)bracken_camera == (Object)null)
			{
				LewdCompany.Log.LogWarning((object)"bracken_cam: STILL null, abort");
				return;
			}
		}
		if ((Object)(object)main_camera != (Object)null)
		{
			((Behaviour)main_camera).enabled = false;
		}
		((Behaviour)bracken_camera).enabled = true;
		bracken_act = true;
		pivoty = 0f;
		pivotx = 0f;
		if ((Object)(object)camPiv != (Object)null)
		{
			camPiv.transform.localRotation = Quaternion.identity;
		}
		Cursor.lockState = (CursorLockMode)1;
		Cursor.visible = false;
		fuck_off_player();
		LewdCompany.Log.LogInfo((object)"bracken cam on");
	}

	private void astral_step()
	{
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Invalid comparison between Unknown and I4
		if ((Object)(object)bracken_camera != (Object)null)
		{
			((Behaviour)bracken_camera).enabled = false;
		}
		if ((Object)(object)main_camera != (Object)null)
		{
			((Behaviour)main_camera).enabled = true;
		}
		fuck_on_player();
		bracken_act = false;
		current_pose = "";
		Cursor.lockState = (CursorLockMode)1;
		Cursor.visible = false;
		if ((Object)(object)bracken != (Object)null)
		{
			Bracken component = bracken.GetComponent<Bracken>();
			if ((Object)(object)component != (Object)null)
			{
				component.state_idle();
			}
		}
		if ((Object)(object)male_animator != (Object)null)
		{
			AnimatorControllerParameter[] parameters = male_animator.parameters;
			foreach (AnimatorControllerParameter val in parameters)
			{
				if ((int)val.type == 9)
				{
					male_animator.ResetTrigger(val.name);
				}
			}
		}
		LewdCompany.Log.LogInfo((object)"bracken off");
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		LewdCompany.Log.LogInfo((object)("bracken scene load " + ((Scene)(ref scene)).name));
		nevermore = false;
		((MonoBehaviour)this).StartCoroutine(main());
	}

	private void find_bracken()
	{
		if (search)
		{
			return;
		}
		search = true;
		Bracken bracken = Object.FindObjectOfType<Bracken>();
		if ((Object)(object)bracken != (Object)null)
		{
			this.bracken = ((Component)bracken).gameObject;
			bracken_anim = this.bracken.GetComponent<Animator>();
			if ((Object)(object)bracken_anim == (Object)null)
			{
				bracken_anim = this.bracken.GetComponentInChildren<Animator>();
			}
			LewdCompany.Log.LogInfo((object)"bracken found via AI");
			search = false;
			return;
		}
		GameObject val = GameObject.Find("bracken(Clone)");
		if ((Object)(object)val != (Object)null)
		{
			this.bracken = val;
			bracken_anim = this.bracken.GetComponent<Animator>();
			if ((Object)(object)bracken_anim == (Object)null)
			{
				bracken_anim = this.bracken.GetComponentInChildren<Animator>();
			}
			LewdCompany.Log.LogInfo((object)"bracken found via name");
			search = false;
		}
		else
		{
			LewdCompany.Log.LogWarning((object)"bracken not found");
			search = false;
		}
	}

	private void ui_ftp()
	{
		if (!((Object)(object)ui_pan != (Object)null) && !((Object)(object)LewdCompany.ui_bracken == (Object)null))
		{
			ui_pan = Object.Instantiate<GameObject>(LewdCompany.ui_bracken);
			Object.DontDestroyOnLoad((Object)(object)ui_pan);
			ui_pan.SetActive(false);
			uiAnimator = ui_pan.GetComponent<Animator>();
			LewdCompany.Log.LogInfo((object)"bracken ui created");
		}
	}

	private void ui_ass()
	{
		if ((Object)(object)ui_pan == (Object)null)
		{
			return;
		}
		LewdCompany.Log.LogInfo((object)"bracken ui ass");
		Button[] componentsInChildren = ui_pan.GetComponentsInChildren<Button>(true);
		int num = 0;
		Button[] array = componentsInChildren;
		foreach (Button val in array)
		{
			if (!((Object)(object)((Component)val).GetComponent<LewdUIButton>() != (Object)null))
			{
				LewdUIButton lewdUIButton = ((Component)val).gameObject.AddComponent<LewdUIButton>();
				lewdUIButton.use_bracken = true;
				switch (((Object)((Component)val).gameObject).name.ToLower())
				{
				case "handjob_butt":
					lewdUIButton.animation_trig = "b_handjob_start";
					lewdUIButton.maleTrigger = "m_handjob_static";
					break;
				case "paizuri_butt":
					lewdUIButton.animation_trig = "b_paizuri_start";
					lewdUIButton.maleTrigger = "m_paizuri_static";
					break;
				case "doggy_butt":
					lewdUIButton.animation_trig = "b_doggy_start";
					lewdUIButton.maleTrigger = "m_doggy_br_start";
					break;
				}
				num++;
			}
		}
		LewdCompany.Log.LogInfo((object)$"bracken stacked {num}");
	}

	private void fuck_off_player()
	{
		if (!((Object)(object)p_l != (Object)null))
		{
			p_l = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)p_l == (Object)null)
			{
				LewdCompany.Log.LogWarning((object)"bracken no player");
				return;
			}
			p_l.disableLookInput = true;
			p_l.disableMoveInput = true;
			p_l.disableInteract = true;
			((Component)p_l).gameObject.SetActive(false);
			p_l.CancelSpecialTriggerAnimations();
			LewdCompany.Log.LogInfo((object)"bracken zxc lock");
		}
	}

	private void fuck_on_player()
	{
		if (!((Object)(object)p_l == (Object)null))
		{
			p_l.disableLookInput = false;
			p_l.disableMoveInput = false;
			p_l.disableInteract = false;
			((Component)p_l).gameObject.SetActive(true);
			p_l.CancelSpecialTriggerAnimations();
			if ((Object)(object)bracken_anim != (Object)null)
			{
				bracken_anim.SetTrigger("idle");
			}
			if ((Object)(object)male_animator != (Object)null)
			{
				male_animator.SetTrigger("m_handjob_static");
			}
			p_l = null;
		}
	}

	public void toggle_men(bool open)
	{
		LewdCompany.Log.LogInfo((object)$"bracken toggle {open}");
		ui_opened = open;
		if ((Object)(object)ui_pan != (Object)null)
		{
			ui_pan.SetActive(open);
		}
		if (open)
		{
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}
		else
		{
			Cursor.lockState = (CursorLockMode)1;
			Cursor.visible = false;
		}
	}

	public bool menu_opened()
	{
		return ui_opened;
	}

	public void zxc_da(string femaleTrigger, string maleTrigger)
	{
		LewdCompany.Log.LogInfo((object)("bracken female " + femaleTrigger + ", male " + maleTrigger));
		if (femaleTrigger.Contains("handjob"))
		{
			current_pose = "handjob";
		}
		else if (femaleTrigger.Contains("paizuri"))
		{
			current_pose = "paizuri";
		}
		else if (femaleTrigger.Contains("doggy"))
		{
			current_pose = "doggy";
		}
		lewd_anim(femaleTrigger);
		if (!string.IsNullOrEmpty(maleTrigger))
		{
			male_lewd(maleTrigger);
		}
	}

	public void lewd_anim(string triggerName)
	{
		LewdCompany.Log.LogInfo((object)("bracken trig set " + triggerName));
		if (triggerName.Contains("handjob"))
		{
			current_pose = "handjob";
		}
		else if (triggerName.Contains("paizuri"))
		{
			current_pose = "paizuri";
		}
		else if (triggerName.Contains("doggy"))
		{
			current_pose = "doggy";
		}
		if ((Object)(object)this.bracken == (Object)null)
		{
			LewdCompany.Log.LogWarning((object)"bracken search girl");
			find_bracken();
			if ((Object)(object)this.bracken == (Object)null)
			{
				return;
			}
		}
		Bracken bracken = this.bracken.GetComponent<Bracken>();
		if ((Object)(object)bracken == (Object)null)
		{
			bracken = this.bracken.AddComponent<Bracken>();
		}
		bracken.start_sex(triggerName);
		if (is_sex(triggerName) && !bracken_act)
		{
			bracken_cam();
		}
		((MonoBehaviour)this).StartCoroutine(close_menu(0.5f));
	}

	public void male_lewd(string triggerName)
	{
		if ((Object)(object)male_animator == (Object)null)
		{
			api_male();
			if ((Object)(object)male_animator == (Object)null)
			{
				return;
			}
		}
		bool flag = false;
		AnimatorControllerParameter[] parameters = male_animator.parameters;
		for (int i = 0; i < parameters.Length; i++)
		{
			if (parameters[i].name == triggerName)
			{
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			return;
		}
		if ((Object)(object)bracken != (Object)null)
		{
			Bracken component = bracken.GetComponent<Bracken>();
			if ((Object)(object)component != (Object)null)
			{
				float femaleLength = component.GetFemaleLength(current_pose + "_start");
				float maleLength = component.GetMaleLength(triggerName);
				if (maleLength > 0f && femaleLength > 0f)
				{
					male_animator.speed = maleLength / femaleLength;
				}
			}
		}
		male_animator.SetTrigger(triggerName);
	}

	private bool is_sex(string triggerName)
	{
		if (!triggerName.Contains("handjob") && !triggerName.Contains("paizuri"))
		{
			return triggerName.Contains("doggy");
		}
		return true;
	}

	private IEnumerator close_menu(float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		toggle_men(open: false);
	}

	private void OnDestroy()
	{
		SceneManager.sceneLoaded -= OnSceneLoaded;
	}
}
public class LewdCompanionInteraction : MonoBehaviour
{
	private bool ins;

	private bool interact;

	private void Start()
	{
		Collider component = ((Component)this).GetComponent<Collider>();
		if (!((Object)(object)component == (Object)null))
		{
			if (!component.isTrigger)
			{
				component.isTrigger = true;
			}
			interact = true;
		}
	}

	private void OnTriggerEnter(Collider other)
	{
		if ((Object)(object)((Component)other).GetComponentInParent<PlayerControllerB>() != (Object)null)
		{
			ins = true;
		}
	}

	private void OnTriggerExit(Collider other)
	{
		if ((Object)(object)((Component)other).GetComponentInParent<PlayerControllerB>() != (Object)null)
		{
			ins = false;
		}
	}

	private void Update()
	{
		if (interact && ins && Keyboard.current != null && ((ButtonControl)Keyboard.current.eKey).wasPressedThisFrame)
		{
			op_menu();
		}
		if (Keyboard.current != null && ((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame && (Object)(object)LewdCompanionManager.Instance != (Object)null)
		{
			LewdCompanionManager.Instance.toggle_men(open: false);
		}
	}

	private void op_menu()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		if ((Object)(object)LewdCompanionManager.Instance == (Object)null && (Object)(object)Object.FindObjectOfType<LewdCompanionManager>() == (Object)null)
		{
			GameObject val = new GameObject("LewdCompanionManager");
			val.AddComponent<LewdCompanionManager>();
			Object.DontDestroyOnLoad((Object)val);
		}
		if ((Object)(object)LewdCompanionManager.Instance != (Object)null)
		{
			LewdCompanionManager.Instance.toggle_men(open: true);
		}
	}
}
public class LewdCompanionManager : MonoBehaviour
{
	private PlayerControllerB p_l;

	private GameObject companion;

	private Animator companion_anim;

	private GameObject male_mod;

	private Animator male_animator;

	private GameObject ui_pan;

	private Animator uiAnimator;

	private bool ui_opened;

	private bool search;

	private bool nevermore;

	private Camera main_camera;

	private GameObject camPiv;

	private Camera sexCamera;

	private bool sex_act;

	private Vector3 last_pos;

	private float pivoty;

	private float pivotx;

	private bool shift;

	private bool cumming;

	private string current_pose = "";

	private Dictionary<string, List<AudioClip>> sfx = new Dictionary<string, List<AudioClip>>();

	public static LewdCompanionManager Instance { get; private set; }

	private void Awake()
	{
		if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		Instance = this;
		LewdCompany.Log.LogInfo((object)"instance");
		Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		SceneManager.sceneLoaded += OnSceneLoaded;
		ui_ftp();
	}

	private void sfx_load()
	{
		string[] array = new string[45]
		{
			"ahh0", "ahh1", "ahh2", "ahh3", "ahh4", "ahh5", "ahh6", "ahh7", "ahh8", "ahh9",
			"mmm0", "mmm1", "mmm2", "mmm3", "mmm4", "mmm5", "mmm6", "mmm7", "mmm8", "mmm9",
			"moan0", "moan1", "moan2", "moan3", "moan4", "moan5", "moan6", "moan7", "pounding0", "pounding1",
			"pounding2", "pounding3", "pounding4", "pounding5", "pounding6", "pounding7", "pounding8", "pounding9", "slide0", "slide1",
			"slide2", "slide3", "slide4", "slide5", "slide6"
		};
		foreach (string text in array)
		{
			AudioClip val = LewdCompany.bundle.LoadAsset<AudioClip>(text);
			if ((Object)(object)val == (Object)null)
			{
				LewdCompany.Log.LogError((object)"suck my dick lmao");
				continue;
			}
			string key = text.TrimEnd('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
			if (!sfx.ContainsKey(key))
			{
				sfx[key] = new List<AudioClip>();
			}
			sfx[key].Add(val);
		}
	}

	public AudioClip pick_sfx(string category)
	{
		if (!sfx.ContainsKey(category))
		{
			return null;
		}
		List<AudioClip> list = sfx[category];
		if (list.Count == 0)
		{
			return null;
		}
		return list[Random.Range(0, list.Count)];
	}

	private void Start()
	{
		LewdCompany.Log.LogInfo((object)"compl");
		((MonoBehaviour)this).StartCoroutine(main());
		cam_find();
	}

	private void cam_find()
	{
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		main_camera = Camera.main;
		if ((Object)(object)main_camera == (Object)null)
		{
			main_camera = Object.FindObjectOfType<Camera>();
		}
		if (!((Object)(object)companion != (Object)null))
		{
			return;
		}
		Transform val = companion.transform.Find("CamPiv");
		if ((Object)(object)val != (Object)null)
		{
			camPiv = ((Component)val).gameObject;
			sexCamera = camPiv.GetComponentInChildren<Camera>();
			if ((Object)(object)sexCamera == (Object)null)
			{
				GameObject val2 = new GameObject("SexCam");
				val2.transform.parent = camPiv.transform;
				val2.transform.localPosition = Vector3.zero;
				val2.transform.localRotation = Quaternion.identity;
				sexCamera = val2.AddComponent<Camera>();
			}
			((Behaviour)sexCamera).enabled = false;
			LewdCompany.Log.LogInfo((object)"gg");
		}
	}

	private IEnumerator main()
	{
		yield return (object)new WaitForSeconds(1f);
		find_slut();
		api_male();
		if (!nevermore)
		{
			ui_ass();
			nevermore = true;
		}
		cam_find();
	}

	private void api_male()
	{
		GameObject val = GameObject.Find("man_mesh");
		if ((Object)(object)val == (Object)null)
		{
			val = GameObject.Find("man_mesh(Clone)");
		}
		if ((Object)(object)val != (Object)null)
		{
			male_mod = val;
			male_animator = val.GetComponent<Animator>();
			if ((Object)(object)male_animator == (Object)null)
			{
				male_animator = val.GetComponentInChildren<Animator>();
			}
			if ((Object)(object)male_animator != (Object)null && !((Behaviour)male_animator).enabled)
			{
				((Behaviour)male_animator).enabled = true;
			}
			LewdCompany.Log.LogInfo((object)"male fucked up");
		}
		else
		{
			LewdCompany.Log.LogWarning((object)"bruh");
		}
	}

	private void Update()
	{
		//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)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
		if (Keyboard.current == null)
		{
			LewdCompany.Log.LogWarning((object)"NO WAY MAN");
			return;
		}
		if (sex_act)
		{
			if (Mouse.current != null)
			{
				Vector2 val = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).delta).ReadValue();
				if (Mouse.current.leftButton.isPressed)
				{
					pivoty += val.x * 0.5f;
					pivotx += val.y * 0.5f;
					pivotx = Mathf.Clamp(pivotx, -80f, 80f);
					if ((Object)(object)camPiv != (Object)null)
					{
						camPiv.transform.localRotation = Quaternion.Euler(pivotx, pivoty, 0f);
					}
				}
				float y = ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y;
				if (y != 0f && (Object)(object)sexCamera != (Object)null)
				{
					float num = sexCamera.fieldOfView - y * 5f;
					sexCamera.fieldOfView = Mathf.Clamp(num, 20f, 100f);
				}
			}
			bool flag = ((ButtonControl)Keyboard.current.leftShiftKey).isPressed || ((ButtonControl)Keyboard.current.rightShiftKey).isPressed;
			if (flag && !shift && (Object)(object)companion != (Object)null && !string.IsNullOrEmpty(current_pose))
			{
				string femaleTrigger = "fast_" + current_pose;
				string maleTrigger = get_male_trigger(current_pose, "fast");
				zxc_da(femaleTrigger, maleTrigger);
			}
			shift = flag;
			bool isPressed = ((ButtonControl)Keyboard.current.spaceKey).isPressed;
			if (isPressed && !cumming && !string.IsNullOrEmpty(current_pose))
			{
				string femaleTrigger2 = "cum_" + current_pose;
				string maleTrigger2 = get_male_trigger(current_pose, "cum");
				zxc_da(femaleTrigger2, maleTrigger2);
			}
			cumming = isPressed;
			if (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame)
			{
				astral_step();
			}
		}
		if (((ButtonControl)Keyboard.current.f1Key).wasPressedThisFrame)
		{
			LewdCompany.Log.LogInfo((object)"f1");
			toggle_men(!ui_opened);
		}
		if (((ButtonControl)Keyboard.current.f2Key).wasPressedThisFrame)
		{
			LewdCompany.Log.LogInfo((object)"f2");
			lewd_anim("strip_on");
		}
		if (((ButtonControl)Keyboard.current.f3Key).wasPressedThisFrame)
		{
			LewdCompany.Log.LogInfo((object)"f3");
			lewd_anim("strip_off");
			if (sex_act)
			{
				astral_step();
			}
		}
		if (((ButtonControl)Keyboard.current.f4Key).wasPressedThisFrame && !fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"f4");
			zxc_da("start_cowgirl", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.f4Key).wasPressedThisFrame && fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"s+f4");
			zxc_da("slow_cowgirl", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.f5Key).wasPressedThisFrame && !fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"f5");
			zxc_da("fast_cowgirl", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.f5Key).wasPressedThisFrame && fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"s+f5");
			zxc_da("cum_cowgirl", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.f6Key).wasPressedThisFrame && !fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"f6");
			zxc_da("start_facesit", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.f6Key).wasPressedThisFrame && fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"s+f6");
			zxc_da("slow_facesit", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.f7Key).wasPressedThisFrame && !fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"f7");
			zxc_da("fast_facesit", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.f7Key).wasPressedThisFrame && fasteeer())
		{
			LewdCompany.Log.LogInfo((object)"s+f7");
			zxc_da("cum_facesit", "facesit_static");
			sex_cam();
		}
		if (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame && ui_opened)
		{
			LewdCompany.Log.LogInfo((object)"esc");
			toggle_men(open: false);
		}
	}

	private string get_male_trigger(string pose, string stage)
	{
		switch (pose)
		{
		case "cowgirl":
		case "facesit":
			return "facesit_static";
		case "doggy":
			switch (stage)
			{
			case "start":
				return "m_dog_st";
			case "slow":
				return "m_dog_slow";
			case "fast":
				return "m_dog_fast";
			case "cum":
				return "m_dog_cum";
			}
			break;
		case "missionary":
			switch (stage)
			{
			case "start":
				return "m_miss_st";
			case "slow":
				return "m_miss_slow";
			case "fast":
				return "m_miss_fast";
			case "cum":
				return "m_miss_cum";
			}
			break;
		case "thingjob":
			switch (stage)
			{
			case "start":
				return "m_thing_st";
			case "slow":
				return "m_thing_slow";
			case "fast":
				return "m_thing_fast";
			case "cum":
				return "m_thing_cum";
			}
			break;
		}
		return "facesit_static";
	}

	private void sex_cam()
	{
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)sexCamera == (Object)null)
		{
			cam_find();
			if ((Object)(object)sexCamera == (Object)null)
			{
				return;
			}
		}
		if ((Object)(object)main_camera != (Object)null)
		{
			((Behaviour)main_camera).enabled = false;
		}
		((Behaviour)sexCamera).enabled = true;
		sex_act = true;
		pivoty = 0f;
		pivotx = 0f;
		ManualLogSource log = LewdCompany.Log;
		object arg = (Object)(object)sexCamera == (Object)null;
		Camera obj = sexCamera;
		object arg2 = ((obj != null) ? new bool?(((Behaviour)obj).enabled) : ((bool?)null));
		Camera obj2 = sexCamera;
		log.LogInfo((object)$"sexCam null? {arg}; enabled: {arg2}; pos: {((obj2 != null) ? new Vector3?(((Component)obj2).transform.position) : ((Vector3?)null))}");
		if ((Object)(object)camPiv != (Object)null)
		{
			camPiv.transform.localRotation = Quaternion.identity;
		}
		Cursor.lockState = (CursorLockMode)1;
		Cursor.visible = false;
		fuck_off_player();
		LewdCompany.Log.LogInfo((object)"sc on sluuut");
	}

	private void astral_step()
	{
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Invalid comparison between Unknown and I4
		if ((Object)(object)sexCamera != (Object)null)
		{
			((Behaviour)sexCamera).enabled = false;
		}
		if ((Object)(object)main_camera != (Object)null)
		{
			((Behaviour)main_camera).enabled = true;
		}
		fuck_on_player();
		sex_act = false;
		current_pose = "";
		Cursor.lockState = (CursorLockMode)1;
		Cursor.visible = false;
		if ((Object)(object)companion != (Object)null)
		{
			LewdCompanionAI component = companion.GetComponent<LewdCompanionAI>();
			if ((Object)(object)component != (Object)null)
			{
				component.state_idle();
			}
		}
		if ((Object)(object)male_animator != (Object)null)
		{
			AnimatorControllerParameter[] parameters = male_animator.parameters;
			foreach (AnimatorControllerParameter val in parameters)
			{
				if ((int)val.type == 9)
				{
					male_animator.ResetTrigger(val.name);
				}
			}
		}
		LewdCompany.Log.LogInfo((object)"sc onnnn bruuuh");
	}

	private bool fasteeer()
	{
		if (!((ButtonControl)Keyboard.current.leftShiftKey).isPressed)
		{
			return ((ButtonControl)Keyboard.current.rightShiftKey).isPressed;
		}
		return true;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		LewdCompany.Log.LogInfo((object)("scene load " + ((Scene)(ref scene)).name));
		nevermore = false;
		((MonoBehaviour)this).StartCoroutine(main());
	}

	private void find_slut()
	{
		if (search)
		{
			return;
		}
		search = true;
		LewdCompanionAI lewdCompanionAI = Object.FindObjectOfType<LewdCompanionAI>();
		if ((Object)(object)lewdCompanionAI != (Object)null)
		{
			companion = ((Component)lewdCompanionAI).gameObject;
			companion_anim = companion.GetComponent<Animator>();
			if ((Object)(object)companion_anim == (Object)null)
			{
				companion_anim = companion.GetComponentInChildren<Animator>();
			}
			LewdCompany.Log.LogInfo((object)"girlf");
			search = false;
			return;
		}
		GameObject val = GameObject.Find("female_lc(Clone)");
		if ((Object)(object)val != (Object)null)
		{
			companion = val;
			companion_anim = companion.GetComponent<Animator>();
			if ((Object)(object)companion_anim == (Object)null)
			{
				companion_anim = companion.GetComponentInChildren<Animator>();
			}
			LewdCompany.Log.LogInfo((object)"found");
			search = false;
		}
		else
		{
			LewdCompany.Log.LogWarning((object)"not found, go fuck");
			search = false;
		}
	}

	private void ui_ftp()
	{
		if (!((Object)(object)ui_pan != (Object)null) && !((Object)(object)LewdCompany.ui == (Object)null))
		{
			ui_pan = Object.Instantiate<GameObject>(LewdCompany.ui);
			Object.DontDestroyOnLoad((Object)(object)ui_pan);
			ui_pan.SetActive(false);
			uiAnimator = ui_pan.GetComponent<Animator>();
			LewdCompany.Log.LogInfo((object)"ui created");
		}
	}

	private void ui_ass()
	{
		if ((Object)(object)ui_pan == (Object)null)
		{
			return;
		}
		LewdCompany.Log.LogInfo((object)"asssss");
		Button[] componentsInChildren = ui_pan.GetComponentsInChildren<Button>(true);
		int num = 0;
		Button[] array = componentsInChildren;
		foreach (Button val in array)
		{
			if (!((Object)(object)((Component)val).GetComponent<LewdUIButton>() != (Object)null))
			{
				LewdUIButton lewdUIButton = ((Component)val).gameObject.AddComponent<LewdUIButton>();
				switch (((Object)((Component)val).gameObject).name.ToLower())
				{
				case "cowgirl_butt":
					lewdUIButton.animation_trig = "start_cowgirl";
					lewdUIButton.maleTrigger = "facesit_static";
					LewdCompany.Log.LogInfo((object)"1 s");
					break;
				case "facesit_butt":
					lewdUIButton.animation_trig = "start_facesit";
					lewdUIButton.maleTrigger = "facesit_static";
					LewdCompany.Log.LogInfo((object)"2 s");
					break;
				case "facedown_doggy_butt":
					lewdUIButton.animation_trig = "start_doggy";
					lewdUIButton.maleTrigger = "m_dog_st";
					LewdCompany.Log.LogInfo((object)"3 s");
					break;
				case "missionary_butt":
					lewdUIButton.animation_trig = "start_missionary";
					lewdUIButton.maleTrigger = "m_miss_st";
					LewdCompany.Log.LogInfo((object)"4 s");
					break;
				case "thing_butt":
					lewdUIButton.animation_trig = "start_thingjob";
					lewdUIButton.maleTrigger = "m_thing_st";
					LewdCompany.Log.LogInfo((object)"6 s");
					break;
				case "strip_butt":
					lewdUIButton.toggle = true;
					LewdCompany.Log.LogInfo((object)"7 s");
					break;
				}
				num++;
			}
		}
		LewdCompany.Log.LogInfo((object)$"stacked {num}");
	}

	private void fuck_off_player()
	{
		if (!((Object)(object)p_l != (Object)null))
		{
			p_l = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)p_l == (Object)null)
			{
				LewdCompany.Log.LogWarning((object)"no player");
				return;
			}
			p_l.disableLookInput = true;
			p_l.disableMoveInput = true;
			p_l.disableInteract = true;
			p_l.CancelSpecialTriggerAnimations();
			((Component)p_l).gameObject.SetActive(false);
			LewdCompany.Log.LogInfo((object)"zxc lock");
		}
	}

	private void fuck_on_player()
	{
		if (!((Object)(object)p_l == (Object)null))
		{
			p_l.disableLookInput = false;
			p_l.disableMoveInput = false;
			p_l.disableInteract = false;
			p_l.CancelSpecialTriggerAnimations();
			if ((Object)(object)companion_anim != (Object)null)
			{
				companion_anim.SetTrigger("idle");
			}
			if ((Object)(object)male_animator != (Object)null)
			{
				male_animator.SetTrigger("facesit_static");
			}
			((Component)p_l).gameObject.SetActive(true);
			p_l = null;
		}
	}

	public void toggle_men(bool open)
	{
		LewdCompany.Log.LogInfo((object)$"toggle {open}");
		ui_opened = open;
		if ((Object)(object)ui_pan != (Object)null)
		{
			ui_pan.SetActive(open);
		}
		if (open)
		{
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			LewdCompany.Log.LogInfo((object)"cur unlock");
		}
		else
		{
			Cursor.lockState = (CursorLockMode)1;
			Cursor.visible = false;
			LewdCompany.Log.LogInfo((object)"cur lock");
		}
	}

	public bool menu_opened()
	{
		return ui_opened;
	}

	public void zxc_da(string femaleTrigger, string maleTrigger)
	{
		LewdCompany.Log.LogInfo((object)(" female " + femaleTrigger + ", male " + maleTrigger));
		if (femaleTrigger.Contains("cowgirl"))
		{
			current_pose = "cowgirl";
		}
		else if (femaleTrigger.Contains("facesit"))
		{
			current_pose = "facesit";
		}
		else if (femaleTrigger.Contains("doggy"))
		{
			current_pose = "doggy";
		}
		else if (femaleTrigger.Contains("missionary"))
		{
			current_pose = "missionary";
		}
		else if (femaleTrigger.Contains("thingjob"))
		{
			current_pose = "thingjob";
		}
		lewd_anim(femaleTrigger);
		if (!string.IsNullOrEmpty(maleTrigger))
		{
			male_lewd(maleTrigger);
		}
	}

	public void lewd_anim(string triggerName)
	{
		LewdCompany.Log.LogInfo((object)("trig set " + triggerName));
		if (triggerName.Contains("cowgirl"))
		{
			current_pose = "cowgirl";
		}
		else if (triggerName.Contains("facesit"))
		{
			current_pose = "facesit";
		}
		else if (triggerName.Contains("doggy"))
		{
			current_pose = "doggy";
		}
		else if (triggerName.Contains("missionary"))
		{
			current_pose = "missionary";
		}
		else if (triggerName.Contains("thingjob"))
		{
			current_pose = "thingjob";
		}
		if ((Object)(object)companion == (Object)null)
		{
			LewdCompany.Log.LogWarning((object)"search girl");
			find_slut();
			if ((Object)(object)companion == (Object)null)
			{
				return;
			}
		}
		LewdCompanionAI lewdCompanionAI = companion.GetComponent<LewdCompanionAI>();
		if ((Object)(object)lewdCompanionAI == (Object)null)
		{
			LewdCompany.Log.LogWarning((object)"wtf");
			lewdCompanionAI = companion.AddComponent<LewdCompanionAI>();
		}
		lewdCompanionAI.start_sex(triggerName);
		if (is_sex(triggerName) && !sex_act)
		{
			sex_cam();
		}
		((MonoBehaviour)this).StartCoroutine(close_menu(0.5f));
	}

	public void male_lewd(string triggerName)
	{
		if ((Object)(object)male_animator == (Object)null)
		{
			api_male();
			if ((Object)(object)male_animator == (Object)null)
			{
				return;
			}
		}
		bool flag = false;
		AnimatorControllerParameter[] parameters = male_animator.parameters;
		for (int i = 0; i < parameters.Length; i++)
		{
			if (parameters[i].name == triggerName)
			{
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			return;
		}
		if ((Object)(object)companion != (Object)null)
		{
			LewdCompanionAI component = companion.GetComponent<LewdCompanionAI>();
			if ((Object)(object)component != (Object)null)
			{
				string name = triggerName.Replace("m_dog_st", "start_doggy").Replace("m_dog_slow", "slow_doggy").Replace("m_dog_fast", "fast_doggy")
					.Replace("m_dog_cum", "cum_doggy")
					.Replace("m_miss_st", "start_missionary")
					.Replace("m_miss_slow", "slow_missionary")
					.Replace("m_miss_fast", "fast_missionary")
					.Replace("m_miss_cum", "cum_missionary")
					.Replace("m_thing_st", "start_thingjob")
					.Replace("m_thing_slow", "slow_thingjob")
					.Replace("m_thing_fast", "fast_thingjob")
					.Replace("m_thing_cum", "cum_thingjob");
				float femaleLength = component.GetFemaleLength(name);
				float maleLength = component.GetMaleLength(triggerName);
				if (maleLength > 0f && femaleLength > 0f)
				{
					male_animator.speed = maleLength / femaleLength;
				}
			}
		}
		male_animator.SetTrigger(triggerName);
	}

	private bool is_sex(string triggerName)
	{
		if (!triggerName.Contains("cowgirl") && !triggerName.Contains("facesit") && !triggerName.Contains("doggy") && !triggerName.Contains("missionary"))
		{
			return triggerName.Contains("thingjob");
		}
		return true;
	}

	public void strip()
	{
		LewdCompany.Log.LogInfo((object)"ui togl strip");
		if ((Object)(object)companion == (Object)null)
		{
			LewdCompany.Log.LogWarning((object)"eblan not found");
			return;
		}
		LewdCompanionAI lewdCompanionAI = companion.GetComponent<LewdCompanionAI>();
		if ((Object)(object)lewdCompanionAI == (Object)null)
		{
			LewdCompany.Log.LogWarning((object)"comp not found");
			lewdCompanionAI = companion.AddComponent<LewdCompanionAI>();
		}
		bool flag = lewdCompanionAI.nude();
		if (flag)
		{
			lewd_anim("strip_off");
		}
		else
		{
			lewd_anim("strip_on");
		}
		LewdCompany.Log.LogInfo((object)$"state {!flag}");
	}

	private IEnumerator close_menu(float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		toggle_men(open: false);
	}

	private void OnDestroy()
	{
		SceneManager.sceneLoaded -= OnSceneLoaded;
	}
}
[BepInPlugin("com.lewdcompany.plugin", "Lewd Company", "1.0.0")]
[BepInProcess("Lethal Company.exe")]
public class LewdCompany : BaseUnityPlugin
{
	public static ManualLogSource Log;

	public static AssetBundle bundle;

	public static GameObject slut;

	public static GameObject ui;

	public static GameObject bracken_prefab;

	public static GameObject ui_bracken;

	public static GameObject yipee_prefab;

	public static GameObject ui_yipee;

	public static GameObject puppet_prefab;

	public static GameObject ui_puppet;

	public static bool isLoaded;

	private void Awake()
	{
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Expected O, but got Unknown
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Expected O, but got Unknown
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e3: Expected O, but got Unknown
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"sexmod loading");
		string text = Path