Decompiled source of ShlongsMod v7.6.0

AtlyssShlongs.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Playables;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AtlyssShlongs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AtlyssShlongs")]
[assembly: AssemblyTitle("AtlyssShlongs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TemtemTests
{
	[BepInPlugin("AtlyssShlongs", "AtlyssShlongs", "1.0.0")]
	public class BoneAttacher : BaseUnityPlugin
	{
		public class ShlongDataSave
		{
			public int DickNumber;

			public float DickOffsetX;

			public float DickOffsetY;

			public float BallsSizeOffset;

			public float SizeOffset;

			public Vector3 AngleOffset;

			public bool FutaToggle;
		}

		[HarmonyPatch(typeof(ProfileDataManager), "Load_ProfileData")]
		public static class AddLoadPatch
		{
			[HarmonyPostfix]
			public static void ShlongLoading(ProfileDataManager __instance, string _filePath, int _index)
			{
				Logger.LogInfo((object)("Loading 5 " + _index));
				if (_index < 105)
				{
					if (!File.Exists(_filePath + "_dick"))
					{
						loadedShlong[_index] = null;
						return;
					}
					Logger.LogInfo((object)"Loading 9");
					loadedShlong[_index] = JsonUtility.FromJson<ShlongDataSave>(File.ReadAllText(_filePath + "_dick"));
					Logger.LogInfo((object)("Loading 7 " + _index + " " + loadedShlong[_index].SizeOffset));
				}
			}
		}

		[HarmonyPatch(typeof(ProfileDataManager), "Save_ProfileData")]
		public static class AddSavePatch
		{
			[HarmonyPostfix]
			public static void ShlongSaving(ProfileDataManager __instance)
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Invalid comparison between Unknown and I4
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				Logger.LogInfo((object)"Saving!");
				ShlongDataSave shlongDataSave = new ShlongDataSave();
				Quaternion localRotation;
				if (!Object.op_Implicit((Object)(object)Player._mainPlayer))
				{
					if ((int)MainMenuManager._current._mainMenuCondition == 2)
					{
						Logger.LogInfo((object)"Saving in char creator");
						DickController dickController = Object.FindObjectOfType<DickController>(false);
						if (Object.op_Implicit((Object)(object)dickController))
						{
							shlongDataSave.DickNumber = dickController.CurrentDick;
							shlongDataSave.DickOffsetX = dickController.DickOffset.x;
							shlongDataSave.DickOffsetY = dickController.DickOffset.y;
							shlongDataSave.BallsSizeOffset = dickController.BallsSizeOffset;
							shlongDataSave.SizeOffset = dickController.DickSizeOffset;
							shlongDataSave.FutaToggle = dickController.FutaToggle;
							localRotation = dickController.SizeBone.transform.localRotation;
							shlongDataSave.AngleOffset = ((Quaternion)(ref localRotation)).eulerAngles;
							string contents = JsonUtility.ToJson((object)shlongDataSave, true);
							File.WriteAllText(__instance._dataPath + $"/atl_characterProfile_{__instance._selectedFileIndex}_dick", contents);
						}
					}
				}
				else
				{
					if (!Object.op_Implicit((Object)(object)Player._mainPlayer))
					{
						return;
					}
					DickController componentInChildren = ((Component)Player._mainPlayer).GetComponentInChildren<DickController>();
					if (Object.op_Implicit((Object)(object)componentInChildren))
					{
						shlongDataSave.DickNumber = componentInChildren.CurrentDick;
						shlongDataSave.DickOffsetX = componentInChildren.DickOffset.x;
						shlongDataSave.DickOffsetY = componentInChildren.DickOffset.y;
						shlongDataSave.BallsSizeOffset = componentInChildren.BallsSizeOffset;
						shlongDataSave.SizeOffset = componentInChildren.DickSizeOffset;
						shlongDataSave.FutaToggle = componentInChildren.FutaToggle;
						localRotation = componentInChildren.SizeBone.transform.localRotation;
						shlongDataSave.AngleOffset = ((Quaternion)(ref localRotation)).eulerAngles;
						if (!Player._mainPlayer._bufferingStatus)
						{
							string contents2 = JsonUtility.ToJson((object)shlongDataSave, true);
							File.WriteAllText(__instance._dataPath + $"/atl_characterProfile_{__instance._selectedFileIndex}_dick", contents2);
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(ChatBehaviour), "Cmd_SendChatMessage")]
		public static class AddChatPatchesCmdSendChatMessage
		{
			[HarmonyPrefix]
			public static void Cmd_SendChatMessage_Prefix(ChatBehaviour __instance, string _message, ChatChannel _chatChannel)
			{
			}
		}

		[HarmonyPatch(typeof(ChatBehaviour), "Send_ChatMessage")]
		public static class AddChatPatches
		{
			[HarmonyPrefix]
			public static void Send_ChatMessage_PostFix(ChatBehaviour __instance, string _message)
			{
			}
		}

		[HarmonyPatch(typeof(ChatBehaviour), "UserCode_Rpc_RecieveChatMessage__String__Boolean__ChatChannel")]
		public static class AddChatPatchesTwo
		{
			[HarmonyPrefix]
			public static bool UserCode_Rpc_RecieveChatMessage__String__Boolean__ChatChannel_Prefix(string message, bool _isEmoteMessage, ChatChannel _chatChannel)
			{
				//IL_00b4: 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)
				//IL_0192: Unknown result type (might be due to invalid IL or missing references)
				if (message.Contains("#NETSYNC#"))
				{
					string[] array = message.Substring(message.IndexOf("#NETSYNC#")).Split('#');
					if (DickControllersDict.ContainsKey(array[2]))
					{
						if (DickControllersDict[array[2]].CurrentDick != int.Parse(array[7], cultInfo))
						{
							DickControllersDict[array[2]].SpawnShlong(int.Parse(array[7], cultInfo));
						}
						DickControllersDict[array[2]].DickOffset = new Vector2(float.Parse(array[3], cultInfo), float.Parse(array[4], cultInfo));
						DickControllersDict[array[2]].DickSizeOffset = float.Parse(array[5], cultInfo);
						DickControllersDict[array[2]].BallsSizeOffset = float.Parse(array[6], cultInfo);
						DickControllersDict[array[2]].ArousalTarget = float.Parse(array[8], cultInfo);
						DickControllersDict[array[2]].FutaToggle = bool.Parse(array[9]);
						DickControllersDict[array[2]].ClothingOverride = bool.Parse(array[10]);
						DickControllersDict[array[2]].SizeBone.transform.localRotation = Quaternion.Euler(float.Parse(array[11], cultInfo), float.Parse(array[12], cultInfo), float.Parse(array[13], cultInfo));
						DickControllersDict[array[2]].RefreshOffsets();
						Logger.LogInfo((object)(array[2] + " set stuff for " + (object)DickControllersDict[array[2]]));
					}
					else
					{
						Logger.LogInfo((object)(array[2] + " this player shlong is not registered? Bug?"));
					}
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ChatBehaviour), "UserCode_Cmd_SendChatMessage__String__ChatChannel")]
		public static class AddChatPatchesThree
		{
			[HarmonyPrefix]
			public static bool UserCode_Cmd_SendChatMessage__String__ChatChannel_Prefix(ChatBehaviour __instance, string _message, ChatChannel _chatChannel)
			{
				if (_message.Contains("#NETSYNC#"))
				{
					__instance.Rpc_RecieveChatMessage(_message, true, (ChatChannel)2);
					return false;
				}
				return true;
			}
		}

		public class AttachableInfo
		{
			public string bodyBoneToAttachTo;

			public string sourceMaterialMesh;

			public int MaterialSlot = 2;
		}

		public class ShlongInfo
		{
			public GameObject prefab;

			public Vector3 Pos;

			public Vector3 Rotation;

			public Vector3 Scale;

			public string PrefabName;

			public string attachableBoneToAttach;

			public string[] BonesToAddDynamicBonesTo;

			public string MeshName;

			public int MaterialSlot = 2;
		}

		public static ShlongDataSave[] loadedShlong;

		internal static ManualLogSource Logger;

		public static AssetBundle bundle;

		public static AnimationClip[] CustomAnimations;

		public static RuntimeAnimatorController CustomController;

		public static ChatBehaviour chatBehaviour;

		public static Dictionary<string, DickController> DickControllersDict;

		public static CultureInfo cultInfo;

		public static AttachableInfo[] ShlongsPos = new AttachableInfo[5];

		public static ShlongInfo[] ShlongsObj = new ShlongInfo[7];

		public static bool CharMenuON = false;

		private void Update()
		{
			if (Time.frameCount % 20 == 0)
			{
				if ((Object)(object)Object.FindObjectOfType<CharacterCreationManager>() != (Object)null)
				{
					CharMenuON = true;
				}
				else
				{
					CharMenuON = false;
				}
			}
		}

		private void Awake()
		{
			loadedShlong = new ShlongDataSave[120];
		}

		private void Start()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0709: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0729: Unknown result type (might be due to invalid IL or missing references)
			//IL_072e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			cultInfo = new CultureInfo("en-US");
			string text = ((BaseUnityPlugin)this).Info.Location.Replace("AtlyssShlongs.dll", "ShlongsPackage.unity3d");
			Harmony val = new Harmony("temtemlover.shlongs.test");
			val.PatchAll();
			DickControllersDict = new Dictionary<string, DickController>();
			bundle = AssetBundle.LoadFromFile(text);
			int num = 0;
			ShlongsPos[num] = new AttachableInfo();
			ShlongsObj[num] = new ShlongInfo();
			ShlongsObj[num].PrefabName = "ByrdleDick";
			ShlongsObj[num].prefab = bundle.LoadAsset<GameObject>(ShlongsObj[num].PrefabName);
			ShlongsObj[num].Pos = new Vector3(0f, -0.00046f, 0.00314f);
			ShlongsObj[num].Scale = new Vector3(2f, 2f, 2f);
			ShlongsObj[num].Rotation = new Vector3(-88.6f, 0f, 0f);
			ShlongsObj[num].attachableBoneToAttach = "DickArmature";
			ShlongsPos[num].bodyBoneToAttachTo = "hip";
			ShlongsObj[num].BonesToAddDynamicBonesTo = new string[1] { "Penis.000" };
			ShlongsObj[num].MeshName = "Byrdle.M";
			ShlongsPos[num].sourceMaterialMesh = "byrdle_body";
			num++;
			ShlongsPos[num] = new AttachableInfo();
			ShlongsObj[num] = new ShlongInfo();
			ShlongsObj[num].PrefabName = "BunnehDick";
			ShlongsObj[num].prefab = bundle.LoadAsset<GameObject>(ShlongsObj[num].PrefabName);
			ShlongsObj[num].Pos = new Vector3(0f, -0.00081f, 0.00252f);
			ShlongsObj[num].Scale = new Vector3(2f, 2f, 2f);
			ShlongsObj[num].Rotation = new Vector3(-100f, 0f, 0f);
			ShlongsObj[num].attachableBoneToAttach = "DickArmature.001";
			ShlongsPos[num].bodyBoneToAttachTo = "hip";
			ShlongsObj[num].BonesToAddDynamicBonesTo = new string[2] { "Penis.000", "Balls" };
			ShlongsObj[num].MeshName = "Bunny.M.001";
			ShlongsPos[num].sourceMaterialMesh = "chang_body";
			num++;
			ShlongsPos[num] = new AttachableInfo();
			ShlongsObj[num] = new ShlongInfo();
			ShlongsObj[num].PrefabName = "ImpDick";
			ShlongsObj[num].prefab = bundle.LoadAsset<GameObject>(ShlongsObj[num].PrefabName);
			ShlongsObj[num].Pos = new Vector3(0f, -0.00165f, 0.00276f);
			ShlongsObj[num].Scale = new Vector3(1.5f, 1.5f, 1.5f);
			ShlongsObj[num].Rotation = new Vector3(-107.394f, 0f, 0f);
			ShlongsObj[num].attachableBoneToAttach = "Armature.001";
			ShlongsPos[num].bodyBoneToAttachTo = "hip";
			ShlongsObj[num].BonesToAddDynamicBonesTo = new string[2] { "Penis.000", "Balls" };
			ShlongsObj[num].MeshName = "FlaccidPeen.001";
			ShlongsPos[num].sourceMaterialMesh = "imp_body";
			num++;
			ShlongsPos[num] = new AttachableInfo();
			ShlongsObj[num] = new ShlongInfo();
			ShlongsObj[num].PrefabName = "KuboldDick";
			ShlongsObj[num].prefab = bundle.LoadAsset<GameObject>(ShlongsObj[num].PrefabName);
			ShlongsObj[num].Pos = new Vector3(0f, 0.00131f, 0.00323f);
			ShlongsObj[num].Scale = new Vector3(2f, 2f, 2f);
			ShlongsObj[num].Rotation = new Vector3(-97.68f, 0f, 0f);
			ShlongsObj[num].attachableBoneToAttach = "SK_BlueDragon.002";
			ShlongsPos[num].bodyBoneToAttachTo = "hip";
			ShlongsObj[num].BonesToAddDynamicBonesTo = new string[1] { "Penis.000" };
			ShlongsObj[num].MeshName = "SK_BlueDragon.male.002";
			ShlongsPos[num].sourceMaterialMesh = "kobold_body";
			num++;
			ShlongsPos[num] = new AttachableInfo();
			ShlongsObj[num] = new ShlongInfo();
			ShlongsObj[num].PrefabName = "CanineDick";
			ShlongsObj[num].prefab = bundle.LoadAsset<GameObject>(ShlongsObj[num].PrefabName);
			ShlongsObj[num].Pos = new Vector3(0f, -0.00081f, 0.00252f);
			ShlongsObj[num].Scale = new Vector3(2f, 2f, 2f);
			ShlongsObj[num].Rotation = new Vector3(-100f, 0f, 0f);
			ShlongsObj[num].attachableBoneToAttach = "SK_Anubis.002";
			ShlongsPos[num].bodyBoneToAttachTo = "hip";
			ShlongsObj[num].BonesToAddDynamicBonesTo = new string[2] { "Penis.000", "Balls1" };
			ShlongsObj[num].MeshName = "CaninePenis";
			ShlongsPos[num].sourceMaterialMesh = "poon_body";
			num++;
			ShlongsObj[num] = new ShlongInfo();
			ShlongsObj[num].PrefabName = "EquineDick";
			ShlongsObj[num].prefab = bundle.LoadAsset<GameObject>(ShlongsObj[num].PrefabName);
			ShlongsObj[num].Pos = new Vector3(0f, -0.00144f, 0.0016f);
			ShlongsObj[num].Scale = new Vector3(1.5f, 1.5f, 1.5f);
			ShlongsObj[num].Rotation = new Vector3(-100f, 0f, 0f);
			ShlongsObj[num].attachableBoneToAttach = "Armature..012";
			ShlongsObj[num].BonesToAddDynamicBonesTo = new string[2] { "Penis.000", "Balls1" };
			ShlongsObj[num].MeshName = "SK_Deer.male.001";
			num++;
			ShlongsObj[num] = new ShlongInfo();
			ShlongsObj[num].PrefabName = "HemiDick";
			ShlongsObj[num].prefab = bundle.LoadAsset<GameObject>(ShlongsObj[num].PrefabName);
			ShlongsObj[num].Pos = new Vector3(0f, 0.00067f, 0.00384f);
			ShlongsObj[num].Scale = new Vector3(1.5f, 1.5f, 1.5f);
			ShlongsObj[num].Rotation = new Vector3(-108.68f, 0f, 0f);
			ShlongsObj[num].attachableBoneToAttach = "HemiArmature";
			ShlongsObj[num].BonesToAddDynamicBonesTo = new string[1] { "Penis.000" };
			ShlongsObj[num].MeshName = "HemiPeenMesh";
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"AtlyssShlongs plugin is loaded!");
			new Hook((MethodBase)AccessTools.Method(typeof(PlayerRaceModel), "Awake", (Type[])null, (Type[])null), (Delegate)new Action<Action<PlayerRaceModel>, PlayerRaceModel>(PlayerAwakeHook));
			new Hook((MethodBase)AccessTools.Method(typeof(ChatBehaviour), "Awake", (Type[])null, (Type[])null), (Delegate)new Action<Action<ChatBehaviour>, ChatBehaviour>(ChatBehaviourAwake));
			new Hook((MethodBase)AccessTools.Method(typeof(RaceModelEquipDisplay), "Update", (Type[])null, (Type[])null), (Delegate)new Action<Action<RaceModelEquipDisplay>, RaceModelEquipDisplay>(RaceModelEquipDisplay_Update));
		}

		public static void ChatBehaviour_New_ChatMessage(Action<ChatBehaviour> orig, ChatBehaviour self, string _message)
		{
			Logger.LogInfo((object)("Logged chat1! " + _message));
			orig(self);
		}

		public static void ChatBehaviour_Cmd_SendChatMessage(Action<ChatBehaviour> orig, ChatBehaviour self, string _message, ChatChannel _chatChannel)
		{
			Logger.LogInfo((object)("Logged chat2! " + _message));
			orig(self);
		}

		public static void ChatBehaviour_Rpc_RecieveChatMessage(Action<ChatBehaviour> orig, ChatBehaviour self, string message, bool _isEmoteMessage, ChatChannel _chatChannel)
		{
			Logger.LogInfo((object)("Logged chat3! " + message));
			orig(self);
		}

		public static void CharacterCreationManagerUpdate(Action<CharacterCreationManager> orig, CharacterCreationManager self)
		{
			orig(self);
			DickController[] array = Object.FindObjectsOfType<DickController>();
			foreach (DickController dickController in array)
			{
				if (Object.op_Implicit((Object)(object)dickController))
				{
					((Renderer)dickController.dickMesh).enabled = self._clothesOffToggle.isOn;
				}
			}
		}

		public static void RaceModelEquipRemove_LeggingsDisplay(Action<RaceModelEquipDisplay> orig, RaceModelEquipDisplay self)
		{
			Transform val = RecursiveFindChild(((Component)self).transform, "DickMesh");
			if (Object.op_Implicit((Object)(object)val))
			{
				((Component)val).gameObject.SetActive(false);
			}
			orig(self);
		}

		public static void RaceModelEquipDisplay_Apply_ArmorDisplay(Action<RaceModelEquipDisplay> orig, RaceModelEquipDisplay self, ScriptableArmor arg1)
		{
			if (((object)arg1).GetType() == typeof(ScriptableLeggings))
			{
				Transform val = RecursiveFindChild(((Component)self).transform, "DickMesh");
				if (Object.op_Implicit((Object)(object)val))
				{
					((Component)val).gameObject.SetActive(true);
				}
			}
			orig(self);
		}

		public static void RaceModelEquipDisplay_Update(Action<RaceModelEquipDisplay> orig, RaceModelEquipDisplay self)
		{
			orig(self);
		}

		public static Transform RecursiveFindChild(Transform parent, string childName)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Object)val).name == childName)
				{
					return val;
				}
				Transform val2 = RecursiveFindChild(val, childName);
				if ((Object)(object)val2 != (Object)null)
				{
					return val2;
				}
			}
			return null;
		}

		public static void ChatBehaviourAwake(Action<ChatBehaviour> orig, ChatBehaviour self)
		{
			orig(self);
			chatBehaviour = self;
		}

		public static void PlayerAwakeHook(Action<PlayerRaceModel> orig, PlayerRaceModel self)
		{
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo((object)("Hooked into player object and spawned Shlong! " + ((Object)self).name));
			((Component)self).gameObject.AddComponent<CustomAnimatorPlayeable>();
			DickController dickController = ((Component)self).gameObject.AddComponent<DickController>();
			int num = -1;
			if (((Object)self).name.Contains("Byrdle"))
			{
				num = 0;
			}
			else if (((Object)self).name.Contains("Poon"))
			{
				num = 4;
			}
			else if (((Object)self).name.Contains("Chang"))
			{
				num = 1;
			}
			else if (((Object)self).name.Contains("Imp"))
			{
				num = 2;
			}
			else if (((Object)self).name.Contains("Kobold") || ((Object)self).name.Contains("Kubold"))
			{
				num = 3;
			}
			if (num == -1)
			{
				orig(self);
				return;
			}
			dickController.OwnerRace = num;
			if (num != -1)
			{
				if ((Object)(object)ProfileDataManager._current != (Object)null && loadedShlong[ProfileDataManager._current.SelectedFileIndex] != null)
				{
					dickController.SpawnShlong(loadedShlong[ProfileDataManager._current.SelectedFileIndex].DickNumber);
					dickController.BallsSizeOffset = loadedShlong[ProfileDataManager._current.SelectedFileIndex].BallsSizeOffset;
					dickController.DickOffset = new Vector2(loadedShlong[ProfileDataManager._current.SelectedFileIndex].DickOffsetX, loadedShlong[ProfileDataManager._current.SelectedFileIndex].DickOffsetY);
					dickController.DickSizeOffset = loadedShlong[ProfileDataManager._current.SelectedFileIndex].SizeOffset;
					dickController.FutaToggle = loadedShlong[ProfileDataManager._current.SelectedFileIndex].FutaToggle;
					dickController.SizeBone.transform.localRotation = Quaternion.Euler(loadedShlong[ProfileDataManager._current.SelectedFileIndex].AngleOffset);
					dickController.RefreshOffsets();
				}
				else
				{
					dickController.SpawnShlong(num);
				}
			}
			Logger.LogInfo((object)"Spawned object?");
			orig(self);
		}
	}
	public class DickController : MonoBehaviour
	{
		public float ArousalTarget = 0f;

		public int OwnerRace = 0;

		public int CurrentDick = 0;

		public SkinnedMeshRenderer dickMesh;

		public GameObject DickControllerObj;

		public GameObject SizeBone;

		public GameObject BallBone;

		public bool FutaToggle = false;

		public RaceModelEquipDisplay raceModelEquipDisplay;

		public float DickSizeOffset = 0f;

		public float BallsSizeOffset = 0f;

		public Vector2 DickOffset = Vector2.zero;

		public Vector2 OldDickOffset = Vector2.zero;

		public Vector2 OldMousePos = Vector2.zero;

		public bool ClothingOverride = false;

		public Transform PelvisBone;

		public Player PlayerObj;

		private bool InitialDickage;

		public static DickController OurDick;

		private void Start()
		{
			raceModelEquipDisplay = ((Component)this).GetComponent<RaceModelEquipDisplay>();
			try
			{
				PlayerObj = ((Component)((Component)this).transform.parent.parent.parent).GetComponent<Player>();
				if (BoneAttacher.DickControllersDict.ContainsKey(PlayerObj.Network_steamID))
				{
					BoneAttacher.DickControllersDict[PlayerObj.Network_steamID] = this;
					MonoBehaviour.InvokeDelayed((MonoBehaviour)(object)this, "SyncOwnDick", Random.Range(5f, 10f), 0f);
					BoneAttacher.Logger.LogInfo((object)"Syncing for new player");
				}
				else
				{
					BoneAttacher.DickControllersDict.Add(PlayerObj.Network_steamID, this);
					MonoBehaviour.InvokeDelayed((MonoBehaviour)(object)this, "SyncOwnDick", Random.Range(5f, 10f), 0f);
					BoneAttacher.Logger.LogInfo((object)"Syncing for new player 2");
				}
			}
			catch (Exception ex)
			{
				BoneAttacher.Logger.LogError((object)ex.Message);
			}
		}

		public void SpawnShlong(int ShlongType)
		{
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//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)
			if (InitialDickage)
			{
				if ((Object)(object)DickControllerObj != (Object)null)
				{
					if ((Object)(object)dickMesh != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)dickMesh).gameObject);
					}
					if ((Object)(object)PelvisBone != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)PelvisBone).gameObject);
					}
					Object.Destroy((Object)(object)DickControllerObj);
				}
			}
			else if ((Object)(object)DickControllerObj != (Object)null)
			{
				DickControllerObj.SetActive(false);
				InitialDickage = true;
			}
			CurrentDick = ShlongType;
			DickControllerObj = Object.Instantiate<GameObject>(BoneAttacher.ShlongsObj[ShlongType].prefab);
			((Object)DickControllerObj).name = BoneAttacher.ShlongsObj[ShlongType].PrefabName;
			BallBone = null;
			string[] bonesToAddDynamicBonesTo = BoneAttacher.ShlongsObj[ShlongType].BonesToAddDynamicBonesTo;
			foreach (string text in bonesToAddDynamicBonesTo)
			{
				Transform val = BoneAttacher.RecursiveFindChild(DickControllerObj.transform, text);
				if ((Object)(object)val != (Object)null)
				{
					DynamicBone val2 = ((Component)val).gameObject.AddComponent<DynamicBone>();
					val2.m_Root = ((Component)val).transform;
					val2.m_Stiffness = 0.85f;
					val2.m_Damping = 0.33f;
					val2.m_Inert = 0.37f;
					if (text.Contains("Balls"))
					{
						BallBone = ((Component)val).gameObject;
						val2.m_Stiffness = 0.4f;
						val2.m_Damping = 0.2f;
						val2.m_Inert = 0.15f;
					}
				}
			}
			DickControllerObj.transform.parent = ((Component)this).transform;
			PelvisBone = BoneAttacher.RecursiveFindChild(DickControllerObj.transform, BoneAttacher.ShlongsObj[ShlongType].attachableBoneToAttach);
			PelvisBone.parent = BoneAttacher.RecursiveFindChild(((Component)this).transform, BoneAttacher.ShlongsPos[OwnerRace].bodyBoneToAttachTo);
			((Component)PelvisBone).transform.localScale = BoneAttacher.ShlongsObj[ShlongType].Scale;
			SizeBone = ((Component)PelvisBone).gameObject;
			((Component)PelvisBone).transform.localPosition = BoneAttacher.ShlongsObj[ShlongType].Pos;
			DickOffset = new Vector2(BoneAttacher.ShlongsObj[ShlongType].Pos.z, BoneAttacher.ShlongsObj[ShlongType].Pos.y);
			((Component)PelvisBone).transform.localRotation = Quaternion.Euler(BoneAttacher.ShlongsObj[ShlongType].Rotation);
			Transform val3 = BoneAttacher.RecursiveFindChild(((Component)this).transform, BoneAttacher.ShlongsPos[OwnerRace].sourceMaterialMesh);
			Transform val4 = BoneAttacher.RecursiveFindChild(DickControllerObj.transform, BoneAttacher.ShlongsObj[ShlongType].MeshName);
			((Object)val4).name = "DickMesh";
			dickMesh = ((Component)val4).GetComponent<SkinnedMeshRenderer>();
			((Renderer)((Component)val4).GetComponent<SkinnedMeshRenderer>()).material = ((Renderer)((Component)val3).GetComponent<SkinnedMeshRenderer>()).materials[BoneAttacher.ShlongsPos[OwnerRace].MaterialSlot];
			RefreshOffsets();
		}

		public void RefreshOffsets()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			SizeBone.transform.localPosition = new Vector3(0f, DickOffset.y, DickOffset.x);
			if (Object.op_Implicit((Object)(object)BallBone))
			{
				BallBone.transform.localScale = Vector3.one + Vector3.one * BallsSizeOffset;
			}
			SizeBone.transform.localScale = BoneAttacher.ShlongsObj[CurrentDick].Scale + Vector3.one * DickSizeOffset;
		}

		private void OnDisable()
		{
			if ((Object)(object)dickMesh != (Object)null)
			{
				((Renderer)dickMesh).enabled = false;
			}
		}

		private void Update()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_066e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)DickControllerObj))
			{
				DickControllerObj.transform.position = ((Component)this).transform.position;
			}
			if (Object.op_Implicit((Object)(object)dickMesh))
			{
				dickMesh.SetBlendShapeWeight(0, Mathf.Lerp(dickMesh.GetBlendShapeWeight(0), ArousalTarget, Time.deltaTime / 2f));
			}
			try
			{
				if (BoneAttacher.CharMenuON)
				{
					((Renderer)dickMesh).enabled = !((Component)raceModelEquipDisplay).GetComponent<PlayerRaceModel>()._displayBoobs || FutaToggle;
					if (!((Component)this).gameObject.activeInHierarchy)
					{
						((Renderer)dickMesh).enabled = false;
					}
				}
				else
				{
					((Renderer)dickMesh).enabled = (!((Component)raceModelEquipDisplay).GetComponent<PlayerRaceModel>()._displayBoobs || FutaToggle) && (ClothingOverride || raceModelEquipDisplay._hideLeggingsVisual || (!Object.op_Implicit((Object)(object)raceModelEquipDisplay._pEquip._equips["Leggings"]._scriptableEquip) && !Object.op_Implicit((Object)(object)raceModelEquipDisplay._pEquip._equips["Leggings"]._vanityEquip)));
					if (!((Component)this).gameObject.activeInHierarchy)
					{
						((Renderer)dickMesh).enabled = false;
					}
					if (!((Behaviour)((Component)((Component)this).transform.parent.parent.parent).GetComponent<PlayerClimbing>()).enabled)
					{
						return;
					}
					OurDick = this;
				}
			}
			catch (Exception)
			{
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)101))
			{
				ArousalTarget = ((ArousalTarget == 0f) ? 100 : 0);
				SyncDick();
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)99))
			{
				ClothingOverride = !ClothingOverride;
				SyncDick();
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)104))
			{
				CurrentDick--;
				if (CurrentDick < 0)
				{
					CurrentDick = BoneAttacher.ShlongsObj.Length - 1;
				}
				SpawnShlong(CurrentDick);
				SyncDick();
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)106))
			{
				CurrentDick++;
				if (CurrentDick >= BoneAttacher.ShlongsObj.Length)
				{
					CurrentDick = 0;
				}
				SpawnShlong(CurrentDick);
				SyncDick();
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)102))
			{
				FutaToggle = !FutaToggle;
				SyncDick();
			}
			if (Object.op_Implicit((Object)(object)BallBone))
			{
				if (Input.GetKey((KeyCode)308) && Input.GetKeyDown((KeyCode)110))
				{
					BallsSizeOffset += 0.07f + BallsSizeOffset * 0.1f;
					BallBone.transform.localScale = Vector3.one + Vector3.one * BallsSizeOffset;
					SyncDick();
				}
				if (Input.GetKey((KeyCode)308) && Input.GetKeyDown((KeyCode)98))
				{
					BallsSizeOffset -= 0.07f + BallsSizeOffset * 0.1f;
					BallBone.transform.localScale = Vector3.one + Vector3.one * BallsSizeOffset;
					SyncDick();
				}
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)110))
			{
				DickSizeOffset += 0.06f + DickSizeOffset * 0.1f;
				SizeBone.transform.localScale = BoneAttacher.ShlongsObj[CurrentDick].Scale + Vector3.one * DickSizeOffset;
				SyncDick();
			}
			if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)98))
			{
				DickSizeOffset -= 0.06f + DickSizeOffset * 0.1f;
				SizeBone.transform.localScale = BoneAttacher.ShlongsObj[CurrentDick].Scale + Vector3.one * DickSizeOffset;
				SyncDick();
			}
			if ((Input.GetKeyDown((KeyCode)308) && Input.GetKey((KeyCode)306)) || (Input.GetKey((KeyCode)308) && Input.GetKeyDown((KeyCode)306)))
			{
				OldMousePos = Vector2.op_Implicit(Input.mousePosition);
				OldDickOffset = DickOffset;
			}
			if (Input.GetKey((KeyCode)308) && Input.GetKey((KeyCode)306))
			{
				DickOffset = OldDickOffset + (Vector2.op_Implicit(Input.mousePosition) - OldMousePos) * 1.5E-05f;
				SizeBone.transform.localPosition = new Vector3(0f, DickOffset.y, DickOffset.x);
				SizeBone.transform.Rotate(Input.mouseScrollDelta.y * 1.5f, 0f, 0f);
			}
			if ((Input.GetKeyUp((KeyCode)308) && Input.GetKey((KeyCode)306)) || (Input.GetKeyUp((KeyCode)308) && Input.GetKeyUp((KeyCode)306)) || (Input.GetKey((KeyCode)308) && Input.GetKeyUp((KeyCode)306)))
			{
				OldMousePos = Vector2.op_Implicit(Input.mousePosition);
				OldDickOffset = DickOffset;
				SyncDick();
			}
			if (Input.GetKeyDown((KeyCode)257))
			{
				SyncDick();
			}
			if (Object.op_Implicit((Object)(object)dickMesh))
			{
				if (((Renderer)dickMesh).enabled)
				{
					((Renderer)dickMesh).enabled = !CameraCollision._current._unhidePlayerModel;
				}
				if (!((Component)this).gameObject.activeInHierarchy)
				{
					((Renderer)dickMesh).enabled = false;
					BoneAttacher.Logger.LogInfo((object)"setting to false??");
				}
			}
		}

		public void SyncOwnDick()
		{
			if (Object.op_Implicit((Object)(object)OurDick.PlayerObj))
			{
				((Component)OurDick.PlayerObj).GetComponent<ChatBehaviour>().Cmd_SendChatMessage("<size=0>#NETSYNC#" + OurDick.PlayerObj.Network_steamID + "#" + OurDick.GetDickInfo() + "#</size>", (ChatChannel)2);
			}
		}

		public void SyncDick()
		{
			if (Object.op_Implicit((Object)(object)PlayerObj))
			{
				((Component)PlayerObj).GetComponent<ChatBehaviour>().Cmd_SendChatMessage("<size=0>#NETSYNC#" + PlayerObj.Network_steamID + "#" + GetDickInfo() + "#</size>", (ChatChannel)2);
			}
		}

		private string GetDickInfo()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[21]
			{
				DickOffset.x.ToString(BoneAttacher.cultInfo),
				"#",
				DickOffset.y.ToString(BoneAttacher.cultInfo),
				"#",
				DickSizeOffset.ToString(BoneAttacher.cultInfo),
				"#",
				BallsSizeOffset.ToString(BoneAttacher.cultInfo),
				"#",
				CurrentDick.ToString(BoneAttacher.cultInfo),
				"#",
				ArousalTarget.ToString(BoneAttacher.cultInfo),
				"#",
				FutaToggle.ToString(BoneAttacher.cultInfo),
				"#",
				ClothingOverride.ToString(BoneAttacher.cultInfo),
				"#",
				null,
				null,
				null,
				null,
				null
			};
			Quaternion localRotation = SizeBone.transform.localRotation;
			obj[16] = ((Quaternion)(ref localRotation)).eulerAngles.x.ToString(BoneAttacher.cultInfo);
			obj[17] = "#";
			localRotation = SizeBone.transform.localRotation;
			obj[18] = ((Quaternion)(ref localRotation)).eulerAngles.y.ToString(BoneAttacher.cultInfo);
			obj[19] = "#";
			localRotation = SizeBone.transform.localRotation;
			obj[20] = ((Quaternion)(ref localRotation)).eulerAngles.z.ToString(BoneAttacher.cultInfo);
			return string.Concat(obj);
		}
	}
	public class CustomAnimatorPlayeable : MonoBehaviour
	{
		private Animator OrigAnimator;

		public RuntimeAnimatorController controller;

		public float weight = 1f;

		private PlayableGraph playableGraph;

		private AnimationMixerPlayable mixerPlayable;

		private AnimatorControllerPlayable newctrlPlayable;

		private void Start()
		{
		}

		private void Update()
		{
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "AtlyssShlongs";

		public const string PLUGIN_NAME = "AtlyssShlongs";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}