Decompiled source of ButteredLillys Vore Mod v1.0.5

Lilly_s_Vore_Mod.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Lilly_s_Vore_Mod;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using Mirror;
using Steamworks;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(MelonLoad), "Lilly's Vore Mod", "1.0.5", "ButteredLilly", null)]
[assembly: MelonGame("KisSoft", "ATLYSS")]
[assembly: MelonOptionalDependencies(new string[] { "BepInEx" })]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Lilly_s_Vore_Mod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+195793dfc91d3126ae4c268eaa05cf9e38514b29")]
[assembly: AssemblyProduct("Lilly_s_Vore_Mod")]
[assembly: AssemblyTitle("Lilly_s_Vore_Mod")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 Lilly_s_Vore_Mod
{
	[BepInPlugin("d3acf21a-a810-4be1-898a-4bb338e62b9f", "Lilly's Vore Mod", "1.0.5")]
	internal class Bepin : BaseUnityPlugin
	{
		private ConfigEntry<bool> autoAccept;

		private ConfigEntry<bool> VoreLock;

		private VoreCore vorecore;

		public void Awake()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			autoAccept = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AutoAccept", false, "Auto Accept Vore Requests");
			VoreLock = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "VoreLock", false, "Toggles Vore Lock");
			if (!((Object)(object)VoreCore.VoreInstance != (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3));
				((Object)val).hideFlags = (HideFlags)61;
				vorecore = val.AddComponent<VoreCore>();
				vorecore.Logger = logger;
				vorecore.saveConfig = saveSettings;
				Harmony val2 = new Harmony("Lilly's Vore Mod");
				val2.PatchAll();
				vorecore.autoAccept = autoAccept.Value;
				vorecore.VoreLock = VoreLock.Value;
			}
		}

		public bool saveSettings(string _)
		{
			try
			{
				autoAccept.Value = vorecore.autoAccept;
				VoreLock.Value = vorecore.VoreLock;
				((BaseUnityPlugin)this).Config.Save();
				return true;
			}
			catch (Exception ex)
			{
				logger(ex.ToString());
				return false;
			}
		}

		public bool logger(string mesg)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)(mesg ?? ""));
			return true;
		}
	}
	public class VoreCore : MonoBehaviour
	{
		public class VoreRequest
		{
			public Player Sender;
		}

		[HarmonyPatch(typeof(Player), "OnGameConditionChange")]
		public static class lillyCred
		{
			[HarmonyPrefix]
			private static void Prefix(ref Player __instance)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Invalid comparison between Unknown and I4
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Invalid comparison between Unknown and I4
				try
				{
					if ((int)__instance.Network_currentGameCondition == 1)
					{
						VoreInstance.sendSteamChat("Lillys Vorable");
					}
					if ((int)__instance.Network_currentGameCondition == 1 && __instance.Network_steamID == "76561198286273592" && !__instance._globalNickname.Contains("color"))
					{
						__instance._globalNickname = "<b><color=red>" + __instance.Network_globalNickname + "</color></b>";
					}
				}
				catch (Exception ex)
				{
					VoreInstance.Logger(ex.Message);
				}
			}
		}

		[HarmonyPatch(typeof(ChatBehaviour), "Cmd_SendChatMessage")]
		public static class chatCommands
		{
			[HarmonyPrefix]
			private static bool Prefix(ref ChatBehaviour __instance, ref string _message)
			{
				try
				{
					string input = _message;
					input = Regex.Replace(input, "<.*?>", "");
					string[] array = input.Split(" ");
					array[0] = array[0].ToLower();
					input = input.ToLower();
					if (array[0] == "/vore")
					{
						if (array.Length < 2)
						{
							__instance.New_ChatMessage("No name Given");
							return false;
						}
						if (VoreInstance.sendVoreRequest(array))
						{
							__instance.New_ChatMessage("Vore Request Sent");
						}
						else
						{
							__instance.New_ChatMessage("Vore Request Failed");
						}
						return false;
					}
					switch (input)
					{
					case "/vorehelp":
						__instance.New_ChatMessage("Commands:\n\nSends Vore Request To Player, Name Is Case Sensitive\n/Vore [Player Name]\n\nAccepts Vore Request\n/AcceptVore\n\nDenys Vore Request\n/DenyVore\n\nExits Vored State If Vore Lock Is Off\n/UnVore\n\nEjects Vored Player, Player Name Is Case Sensitive\n/UnVore [Player Name]\n\nToggles Auto Accepting Vore Requests\n/AutoAccept\n\nLists Players That Can Be Vored\n/Vorable\n\nKeeps You Vored Till Let Out\n/VoreLock");
						return false;
					case "/autoaccept":
						VoreInstance.autoAccept = !VoreInstance.autoAccept;
						__instance.New_ChatMessage($"Auto Accpet Vore: {VoreInstance.autoAccept}");
						VoreInstance.saveConfig("");
						return false;
					case "/acceptvore":
						if (VoreInstance.currentRequest == null)
						{
							__instance.New_ChatMessage("No Current Vore Request");
						}
						else if (VoreInstance.acceptVore())
						{
							__instance.New_ChatMessage("Vore Request Accpeted");
						}
						else
						{
							__instance.New_ChatMessage("Vore Request Failed");
						}
						return false;
					case "/denyvore":
						if (VoreInstance.currentRequest == null)
						{
							__instance.New_ChatMessage("No Current Vore Request");
						}
						else
						{
							VoreInstance.currentRequest = null;
							__instance.New_ChatMessage("Vore Request Denied");
						}
						return false;
					default:
						if (array[0] == "/unvore")
						{
							if (array.Length > 1)
							{
								VoreInstance.unvore(array);
							}
							else if (!VoreInstance.Vored)
							{
								__instance.New_ChatMessage("Not Currently Vored");
							}
							else if (VoreInstance.VoreLock)
							{
								__instance.New_ChatMessage("Can't Escape");
							}
							else
							{
								VoreInstance.exitVore();
							}
							return false;
						}
						if (input == "/vorable")
						{
							VoreInstance.voreAble.RemoveAll((Player Player) => (Object)(object)Player == (Object)null);
							__instance.New_ChatMessage("Vorable:");
							foreach (Player item in VoreInstance.voreAble)
							{
								string nickname = item._nickname;
								nickname = Regex.Replace(nickname, "<.*?>", "");
								__instance.New_ChatMessage(nickname);
							}
							return false;
						}
						if (input == "/vorelock")
						{
							if (VoreInstance.VoreLock && VoreInstance.Vored)
							{
								__instance.New_ChatMessage("Don't Think You Can Get Out That Easily Now");
								return false;
							}
							VoreInstance.VoreLock = !VoreInstance.VoreLock;
							__instance.New_ChatMessage($"Vore Lock: {VoreInstance.VoreLock}");
							VoreInstance.saveConfig("");
							return false;
						}
						break;
					}
				}
				catch (Exception)
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Player), "Handle_ServerParameters")]
		public static class fixPlayer
		{
			[HarmonyPostfix]
			public static void Postfix(ref Player __instance)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Invalid comparison between Unknown and I4
				try
				{
					if (!((Object)(object)VoreInstance.localPlayer != (Object)null) && (int)__instance.Network_currentPlayerCondition == 2 && ((NetworkBehaviour)__instance).isLocalPlayer && (int)__instance.Network_currentPlayerCondition == 2 && ((NetworkBehaviour)__instance).isLocalPlayer)
					{
						VoreInstance.localPlayer = __instance;
						ref NetworkTransformUnreliable localNettransform = ref VoreInstance.localNettransform;
						NetworkBehaviour obj = ((NetworkBehaviour)__instance).netIdentity.NetworkBehaviours[0];
						localNettransform = (NetworkTransformUnreliable)(object)((obj is NetworkTransformUnreliable) ? obj : null);
						ChatBehaviour._current.New_ChatMessage("Type /VoreHelp For Commands");
					}
				}
				catch (Exception)
				{
				}
			}
		}

		[HarmonyPatch(typeof(ScriptablePlayerRace), "Init_ParamsCheck")]
		public static class bypass
		{
			[HarmonyPrefix]
			private static bool Prefix(ref PlayerAppearance_Profile _aP, ref PlayerAppearance_Profile __result)
			{
				__result = _aP;
				return false;
			}
		}

		[HarmonyPatch(typeof(AtlyssNetworkManager), "OnStopClient")]
		public static class reset
		{
			[HarmonyPostfix]
			public static void Postfix()
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					if (VoreInstance.Vored)
					{
						PlayerAppearanceStruct playerAppearanceStruct = VoreInstance.localPlayer._pVisual._playerAppearanceStruct;
						PlayerAppearance_Profile appearanceProfile = ProfileDataManager._current._characterFile._appearanceProfile;
						playerAppearanceStruct._heightWeight = VoreInstance.playSize.x;
						playerAppearanceStruct._widthWeight = VoreInstance.playSize.y;
						appearanceProfile._heightWeight = VoreInstance.playSize.x;
						appearanceProfile._widthWeight = VoreInstance.playSize.y;
						ProfileDataManager._current._characterFile._appearanceProfile = appearanceProfile;
						ProfileDataManager._current.Save_ProfileData();
					}
					VoreInstance.localPlayer = null;
					VoreInstance.currentRequest = null;
					VoreInstance.voredBy = null;
					VoreInstance.Vored = false;
					VoreInstance.voreAble.Clear();
				}
				catch (Exception)
				{
				}
			}
		}

		public static VoreCore VoreInstance;

		public bool autoAccept = false;

		public bool Vored = false;

		public bool VoreLock = false;

		public Func<string, bool> Logger;

		public Func<string, bool> saveConfig;

		protected Callback<LobbyChatMsg_t> messageRecived;

		public List<Player> voreAble;

		private Player localPlayer;

		private NetworkTransformUnreliable localNettransform;

		private Player voredBy;

		private VoreRequest currentRequest;

		private Vector2 playSize;

		public void sendSteamChat(string message)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			byte[] bytes = Encoding.ASCII.GetBytes(message);
			CSteamID val = default(CSteamID);
			((CSteamID)(ref val))..ctor(SteamLobby._current._currentLobbyID);
			SteamMatchmaking.SendLobbyChatMsg(val, bytes, bytes.Length);
		}

		public bool unvore(string[] parts)
		{
			string text = parts[1];
			if (parts.Length > 2)
			{
				for (int i = 2; i < parts.Length; i++)
				{
					text = text + " " + parts[i];
				}
			}
			VoreInstance.voreAble.RemoveAll((Player Player) => (Object)(object)Player == (Object)null);
			foreach (Player item in voreAble)
			{
				string nickname = item._nickname;
				nickname = Regex.Replace(nickname, "<.*?>", "");
				if (nickname == text)
				{
					sendSteamChat(item._nickname + ",Unvore");
					return true;
				}
			}
			return false;
		}

		public bool sendVoreRequest(string[] parts)
		{
			string text = parts[1];
			if (parts.Length > 2)
			{
				for (int i = 2; i < parts.Length; i++)
				{
					text = text + " " + parts[i];
				}
			}
			VoreInstance.voreAble.RemoveAll((Player Player) => (Object)(object)Player == (Object)null);
			foreach (Player item in voreAble)
			{
				string nickname = item._nickname;
				nickname = Regex.Replace(nickname, "<.*?>", "");
				if (nickname == text)
				{
					sendSteamChat(item._nickname + ",VoreRequest");
					return true;
				}
			}
			return false;
		}

		public bool acceptVore()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerAppearanceStruct playerAppearanceStruct = localPlayer._pVisual._playerAppearanceStruct;
				if (!Vored)
				{
					playSize = new Vector2(localPlayer._pVisual._playerAppearanceStruct._heightWeight, localPlayer._pVisual._playerAppearanceStruct._widthWeight);
				}
				playerAppearanceStruct._heightWeight = 0f;
				playerAppearanceStruct._widthWeight = 0f;
				localPlayer._pVisual.Cmd_SendNew_PlayerAppearanceStruct(playerAppearanceStruct);
				voredBy = currentRequest.Sender;
				Vored = true;
				return true;
			}
			catch (Exception ex)
			{
				Logger(ex.ToString());
				return false;
			}
		}

		public bool exitVore()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerAppearanceStruct playerAppearanceStruct = localPlayer._pVisual._playerAppearanceStruct;
				playerAppearanceStruct._heightWeight = playSize.x;
				playerAppearanceStruct._widthWeight = playSize.y;
				localPlayer._pVisual.Cmd_SendNew_PlayerAppearanceStruct(playerAppearanceStruct);
				currentRequest = null;
				voredBy = null;
				Vored = false;
				return true;
			}
			catch (Exception ex)
			{
				Logger(ex.ToString());
				return false;
			}
		}

		private void Update()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Vored && (Object)(object)voredBy != (Object)null)
				{
					if (voredBy.Network_mapName != localPlayer.Network_mapName)
					{
						exitVore();
					}
					((NetworkTransformBase)localNettransform).CmdTeleport(((Component)voredBy).gameObject.transform.position);
				}
				else if (Vored)
				{
					exitVore();
				}
			}
			catch (Exception ex)
			{
				Logger(ex.ToString());
			}
		}

		public void Start()
		{
			VoreInstance = this;
			messageRecived = Callback<LobbyChatMsg_t>.Create((DispatchDelegate<LobbyChatMsg_t>)onMessage);
			voreAble = new List<Player>();
		}

		private void onMessage(LobbyChatMsg_t callback)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((CSteamID)callback.m_ulSteamIDUser == SteamUser.GetSteamID())
				{
					return;
				}
				int num = 5000;
				byte[] array = new byte[num];
				CSteamID val = default(CSteamID);
				EChatEntryType val2 = default(EChatEntryType);
				SteamMatchmaking.GetLobbyChatEntry((CSteamID)callback.m_ulSteamIDLobby, (int)callback.m_iChatID, ref val, array, num, ref val2);
				string @string = Encoding.ASCII.GetString(array);
				if (@string.Contains("Lillys Vorable"))
				{
					Player val3 = findPlayer((CSteamID)callback.m_ulSteamIDUser);
					if (!((Object)(object)val3 == (Object)null) && !voreAble.Contains(val3))
					{
						Logger(val3._nickname);
						voreAble.Add(val3);
					}
				}
				else if (@string.Contains("VoreRequest"))
				{
					string text = Regex.Replace(@string.Split(",")[0], "<.*?>", "");
					string text2 = Regex.Replace(localPlayer._nickname, "<.*?>", "");
					if (!(text2 == text))
					{
						return;
					}
					Player val4 = findPlayer((CSteamID)callback.m_ulSteamIDUser);
					if (!((Object)(object)val4 == (Object)null))
					{
						currentRequest = new VoreRequest();
						currentRequest.Sender = val4;
						if (!autoAccept || Vored)
						{
							ChatBehaviour._current.New_ChatMessage("Vore Request From " + val4._nickname + " Use /AcceptVore To Be Vored");
							return;
						}
						acceptVore();
						ChatBehaviour._current.New_ChatMessage("You've Been Vored By " + val4._nickname);
					}
				}
				else
				{
					if (!@string.Contains("Unvore"))
					{
						return;
					}
					string text3 = Regex.Replace(@string.Split(",")[0], "<.*?>", "");
					string text4 = Regex.Replace(localPlayer._nickname, "<.*?>", "");
					if (text4 == text3)
					{
						Player val5 = findPlayer((CSteamID)callback.m_ulSteamIDUser);
						if (!((Object)(object)val5 == (Object)null) && Vored)
						{
							exitVore();
							ChatBehaviour._current.New_ChatMessage("You've Been Unvored");
						}
					}
				}
			}
			catch (Exception ex)
			{
				Logger(ex.ToString());
			}
		}

		public Player findPlayer(CSteamID steamID)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			try
			{
				Object[] array = Object.FindObjectsOfType(typeof(Player));
				for (int i = 0; i < array.Length; i++)
				{
					Player val = (Player)array[i];
					if (val.Network_steamID == ((object)(CSteamID)(ref steamID)).ToString())
					{
						return val;
					}
				}
			}
			catch (Exception ex)
			{
				Logger(ex.ToString());
				return null;
			}
			return null;
		}
	}
	internal class MelonLoad : MelonMod
	{
		private MelonPreferences_Category general;

		private MelonPreferences_Entry<bool> autoAccept;

		private MelonPreferences_Entry<bool> VoreLock;

		private VoreCore vorecore;

		public override void OnInitializeMelon()
		{
			general = MelonPreferences.CreateCategory("General");
			autoAccept = general.CreateEntry<bool>("AutoAccept", false, "AutoAccept", "Auto Accept Vore Requests", false, false, (ValueValidator)null, (string)null);
			VoreLock = general.CreateEntry<bool>("VoreLock", false, "VoreLock", "Toggle Vore Lock", false, false, (ValueValidator)null, (string)null);
			if (!((Object)(object)VoreCore.VoreInstance != (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3));
				((Object)val).name = "VoreCore";
				((Object)val).hideFlags = (HideFlags)61;
				vorecore = val.AddComponent<VoreCore>();
				vorecore.Logger = logger;
				vorecore.saveConfig = saveSettings;
				vorecore.autoAccept = autoAccept.Value;
				vorecore.VoreLock = VoreLock.Value;
			}
		}

		public bool saveSettings(string _)
		{
			try
			{
				autoAccept.Value = vorecore.autoAccept;
				VoreLock.Value = vorecore.VoreLock;
				MelonPreferences.Save();
				return true;
			}
			catch (Exception ex)
			{
				logger(ex.ToString());
				return false;
			}
		}

		public bool logger(string mesg)
		{
			MelonLogger.Msg(mesg);
			return true;
		}
	}
}