Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LovenseController v1.0.1
LovenseLushController.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LovenseBLE; using LovenseLushController; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LovenseLushController")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9c5ff49e53f94cca91a0adc4d0784de1d59710ef")] [assembly: AssemblyProduct("Repo Lovense Lush Controller")] [assembly: AssemblyTitle("LovenseLushController")] [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; } } } public static class BuildInfo { public const int BuildNumber = 151; } namespace LovenseBLE { internal class LovenseBLEClasses { } public class ToySupport { public string type; public string showName; public LovenseCommandType[] supported; } public enum LovenseCommandType { VIBRATE, VIBRATE1, VIBRATE2, VIBRATE3, ROTATE, PUMP, THRUSTRING, FINGERING, SUCTION, DEPTH, POSITION, OSCILLATE, GET_BATTERY } public enum LovenseDataReportingEventType { KEY_DOWN, KEY_UP, VIBTATE, ROTATE, SHAKE, MOVEMENT, DEEP, AIR_IN, AIR_OUT, AIR_CLOSE, AIR_OPEN, BATTERY, STROKE_SPEED_POSITION, SHAKE_TIMES } public enum InitSupportCommandStatus { SUCCESS, FAILED } public enum CheckBLEResultStatus { BLE_ENABLE_OPEN, BLE_ENABLE_CLOSE, BLE_DISABLE, EXCEPTION } public enum LovenseNotifyType { SCAN_START, SCAN_STOP, EXECUTE_SUCCESS, EXECUTE_FAILED, FAILED_SCANNINGING_NOW, DIS_CONNECTION_SUCCESS, DIS_CONNECTION_ERROR, CONNECTION_SUCCESS, CONNECTION_ERROR, TOY_NO_CONNECT, BLE_DISABLE_OR_CLOSE } public class LovenseCommand { public LovenseCommandType commandType; public int value; } public class LovenseSolaceProCommand : LovenseCommand { public int speedLevel; public int strokeLow; public int strokeHigh; } public class LovenseToy { public string id; public string name; public string type; public string mac; public bool connected; public override bool Equals(object obj) { return Equals(obj as LovenseToy); } public bool Equals(LovenseToy other) { if (other == null) { return false; } if (this == other) { return true; } return id == other.id; } public override int GetHashCode() { return id.GetHashCode(); } } internal class LovenseBLETools { [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void _NotifyCallbackDelegate(int result, [MarshalAs(UnmanagedType.LPWStr)] string id); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void _ToyAddCallbackDelegate([MarshalAs(UnmanagedType.LPWStr)] string toyId, [MarshalAs(UnmanagedType.LPWStr)] string name, [MarshalAs(UnmanagedType.LPWStr)] string address, char c0, char c1); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void _CheckBLECallbackDelegate(int result); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void _EventsAPICallbackDelegate([MarshalAs(UnmanagedType.LPWStr)] string toyId, int type, int hadrdwareType, int value); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void _ConnectChangedDelegate([MarshalAs(UnmanagedType.LPWStr)] string toyId, bool connected); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void _BatteryDelegate([MarshalAs(UnmanagedType.LPWStr)] string toyId, [MarshalAs(UnmanagedType.LPWStr)] string battery); public delegate void ResultBLEEvent(CheckBLEResultStatus status); public delegate void AddToyEvent(LovenseToy toy); public delegate void ConnectChangedEvent(string id, bool connected); public delegate void EventsAPIEvent(string id, LovenseDataReportingEventType type, int hardwareType, int value); public delegate void BatteryEvent(string id, string battery); public delegate void LovenseNotifyEventEvent(LovenseNotifyType type, string deviceId); private static _NotifyCallbackDelegate _notifyCallback; private static _ToyAddCallbackDelegate _toyAddCallback; private static _CheckBLECallbackDelegate _checkBLECallback; private static _EventsAPICallbackDelegate _eventsAPICallback; private static _ConnectChangedDelegate _connectChangedCallback; private static _BatteryDelegate _batteryCallback; private static LovenseBLETools instance; private List<LovenseToy> toys = new List<LovenseToy>(); private Dictionary<string, ToySupport> supportedCommandDic = new Dictionary<string, ToySupport>(); public event ResultBLEEvent resultBLEEvent; public event AddToyEvent addToyEvent; public event ConnectChangedEvent connectChangeEvent; public event EventsAPIEvent eventsAPIevent; public event BatteryEvent batteryEvent; public event LovenseNotifyEventEvent lovenseNotifyEvent; [DllImport("LovenseBLE_Lib.dll")] private static extern void _RegisterNotifyCallback(_NotifyCallbackDelegate callback); [DllImport("LovenseBLE_Lib.dll")] private static extern void _RegisterToyAddCallback(_ToyAddCallbackDelegate callback); [DllImport("LovenseBLE_Lib.dll")] private static extern void _RegisterCheckBLECallback(_CheckBLECallbackDelegate callback); [DllImport("LovenseBLE_Lib.dll")] private static extern void _RegisterEventsAPICallback(_EventsAPICallbackDelegate callback); [DllImport("LovenseBLE_Lib.dll")] private static extern void _RegisterConnectChangedCallback(_ConnectChangedDelegate callback); [DllImport("LovenseBLE_Lib.dll")] private static extern void _RegisterBatteryCallback(_BatteryDelegate callback); [DllImport("LovenseBLE_Lib.dll")] public static extern void _Quit(); [DllImport("LovenseBLE_Lib.dll")] public static extern void _CheckBLEStatus(); [DllImport("LovenseBLE_Lib.dll")] public static extern void _StartBLEScan(); [DllImport("LovenseBLE_Lib.dll")] public static extern void _StopBLEScan(); [DllImport("LovenseBLE_Lib.dll")] public static extern void _ConnectToy([MarshalAs(UnmanagedType.LPWStr)] string deviceId); [DllImport("LovenseBLE_Lib.dll")] public static extern void _DisConnectToy([MarshalAs(UnmanagedType.LPWStr)] string deviceId); [DllImport("LovenseBLE_Lib.dll")] public static extern void _SendCommand([MarshalAs(UnmanagedType.LPWStr)] string deviceId, int commandType, int value); [DllImport("LovenseBLE_Lib.dll")] public static extern void _SendCommandToSolacePro([MarshalAs(UnmanagedType.LPWStr)] string deviceId, int speed, int strokeLow, int strokeHigh); [DllImport("LovenseBLE_Lib.dll")] public static extern void _OpenSolaceProEventsAPI([MarshalAs(UnmanagedType.LPWStr)] string deviceId, int mode); [DllImport("LovenseBLE_Lib.dll")] public static extern void _CloseSolaceProEventsAPI([MarshalAs(UnmanagedType.LPWStr)] string deviceId); [DllImport("LovenseBLE_Lib.dll")] public static extern void _OpenEventsAPI([MarshalAs(UnmanagedType.LPWStr)] string deviceId); [DllImport("LovenseBLE_Lib.dll")] public static extern void _CloseEventsAPI([MarshalAs(UnmanagedType.LPWStr)] string deviceId); public static LovenseBLETools GetInstance() { if (instance == null) { instance = new LovenseBLETools(); } return instance; } public void InitCallback() { InitCheckBleResultCallback(); InitEventsApiCallback(); InitNotifyResultCallback(); InitToyAddCallback(); InitConnectChangedCallback(); InitBatteryCallback(); } public void InitNotifyResultCallback() { if (_notifyCallback == null) { _notifyCallback = OnNotifyResult; _RegisterNotifyCallback(_notifyCallback); } } private void OnNotifyResult(int result, string id) { if (this.lovenseNotifyEvent != null) { this.lovenseNotifyEvent((LovenseNotifyType)result, id); } } public void InitCheckBleResultCallback() { if (_checkBLECallback == null) { _checkBLECallback = OnCheckBLEResult; _RegisterCheckBLECallback(_checkBLECallback); } } private void OnCheckBLEResult(int result) { if (this.resultBLEEvent != null) { this.resultBLEEvent((CheckBLEResultStatus)result); } } public void InitToyAddCallback() { if (_toyAddCallback == null) { _toyAddCallback = OnToyAddResult; _RegisterToyAddCallback(_toyAddCallback); } } private void OnToyAddResult(string toyId, string name, string address, char c0, char c1) { if (this.addToyEvent != null) { string key = (c0.ToString() + c1).Replace("0", "").ToLower(); if (supportedCommandDic.ContainsKey(key)) { this.addToyEvent(new LovenseToy { name = name, id = toyId, mac = address, type = supportedCommandDic[key].type }); } else { this.addToyEvent(new LovenseToy { name = name, id = toyId, mac = address, type = "unknown" }); } } } public void InitEventsApiCallback() { if (_eventsAPICallback == null) { _eventsAPICallback = OnEventsApiResult; _RegisterEventsAPICallback(_eventsAPICallback); } } private void OnEventsApiResult(string toyId, int type, int hadrdwareType, int value) { if (this.eventsAPIevent != null) { this.eventsAPIevent(toyId, (LovenseDataReportingEventType)type, hadrdwareType, value); } } public void InitConnectChangedCallback() { if (_connectChangedCallback == null) { _connectChangedCallback = OnConnectChanged; _RegisterConnectChangedCallback(_connectChangedCallback); } } private void OnConnectChanged(string toyId, bool connected) { if (this.connectChangeEvent != null) { this.connectChangeEvent(toyId, connected); } } public void InitBatteryCallback() { if (_batteryCallback == null) { _batteryCallback = OnGetBattery; _RegisterBatteryCallback(OnGetBattery); } } private void OnGetBattery(string toyId, string battery) { if (this.batteryEvent != null) { this.batteryEvent(toyId, battery); } } public void InitSupport(string supportTextData, Action<InitSupportCommandStatus> completed) { supportedCommandDic.Clear(); try { List<LovenseCommandType> list = new List<LovenseCommandType>(); supportTextData = supportTextData.Replace("\"\"", "\""); string[] array = supportTextData.Split('\n'); for (int i = 0; i < array.Length; i++) { if (i < 2) { continue; } string input = array[i]; list.Clear(); string pattern = "^.??,|\\[.*\\]|(?<=^|,)\\w+|\\{.*\\}"; MatchCollection matchCollection = Regex.Matches(input, pattern); List<string> list2 = new List<string>(); foreach (Match item in matchCollection) { list2.Add(item.Value); } if (list2.Count == 7) { string[] array2 = list2[2].Replace("[", "").Replace("]", "").Replace("\\", "") .Replace("\"", "") .Split(','); string type = list2[4]; string showName = list2[5]; string input2 = list2[6].Replace(" ", "").Replace("\"", ""); MatchCollection matchCollection2 = Regex.Matches(input2, "(?<=v:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE); } matchCollection2 = Regex.Matches(input2, "(?<=v1:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE1); } matchCollection2 = Regex.Matches(input2, "(?<=v2:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE2); } matchCollection2 = Regex.Matches(input2, "(?<=v3:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE3); } matchCollection2 = Regex.Matches(input2, "(?<=r:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.ROTATE); } matchCollection2 = Regex.Matches(input2, "(?<=p:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.PUMP); } matchCollection2 = Regex.Matches(input2, "(?<=t:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.THRUSTRING); } matchCollection2 = Regex.Matches(input2, "(?<=f:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.FINGERING); } matchCollection2 = Regex.Matches(input2, "(?<=s:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.SUCTION); } matchCollection2 = Regex.Matches(input2, "(?<=d:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.DEPTH); } matchCollection2 = Regex.Matches(input2, "(?<=pos:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.POSITION); } matchCollection2 = Regex.Matches(input2, "(?<=o:)(false|true)"); if (matchCollection2.Count > 0 && matchCollection2[0].Value == "true") { list.Add(LovenseCommandType.OSCILLATE); } string[] array3 = array2; foreach (string text in array3) { ToySupport toySupport = new ToySupport(); toySupport.type = type; toySupport.showName = showName; toySupport.supported = list.ToArray(); supportedCommandDic.Add(text.Trim(), toySupport); } } else if (list2.Count == 5) { string[] array4 = list2[1].Replace("[", "").Replace("]", "").Replace("\\", "") .Replace("\"", "") .Split(','); string type2 = list2[2]; string showName2 = list2[3]; string input3 = list2[4].Replace(" ", "").Replace("\"", ""); MatchCollection matchCollection3 = Regex.Matches(input3, "(?<=v:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE); } matchCollection3 = Regex.Matches(input3, "(?<=v1:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE1); } matchCollection3 = Regex.Matches(input3, "(?<=v2:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE2); } matchCollection3 = Regex.Matches(input3, "(?<=v3:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.VIBRATE3); } matchCollection3 = Regex.Matches(input3, "(?<=r:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.ROTATE); } matchCollection3 = Regex.Matches(input3, "(?<=p:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.PUMP); } matchCollection3 = Regex.Matches(input3, "(?<=t:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.THRUSTRING); } matchCollection3 = Regex.Matches(input3, "(?<=f:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.FINGERING); } matchCollection3 = Regex.Matches(input3, "(?<=s:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.SUCTION); } matchCollection3 = Regex.Matches(input3, "(?<=d:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.DEPTH); } matchCollection3 = Regex.Matches(input3, "(?<=pos:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.POSITION); } matchCollection3 = Regex.Matches(input3, "(?<=o:)(false|true)"); if (matchCollection3.Count > 0 && matchCollection3[0].Value == "true") { list.Add(LovenseCommandType.OSCILLATE); } string[] array3 = array4; foreach (string text2 in array3) { ToySupport toySupport2 = new ToySupport(); toySupport2.type = type2; toySupport2.showName = showName2; toySupport2.supported = list.ToArray(); supportedCommandDic.Add(text2.Trim(), toySupport2); } } } completed?.Invoke(InitSupportCommandStatus.SUCCESS); } catch (Exception) { completed?.Invoke(InitSupportCommandStatus.FAILED); } } public void CheckBLEStatus() { _CheckBLEStatus(); } public void StartBLEScan() { _StartBLEScan(); } public void StopBLEScan() { _StopBLEScan(); } public void ConnectToy(string id) { _ConnectToy(id); } public void DisConnectToy(string id) { _DisConnectToy(id); } public void StartEventsAPI(string id) { _OpenEventsAPI(id); } public void CloseEventsAPI(string id) { _CloseEventsAPI(id); } public void StartSolaceProEventsAPI(string id, int mode) { _OpenSolaceProEventsAPI(id, mode); } public void CloseSolaceProEventsAPI(string id) { _CloseSolaceProEventsAPI(id); } public void SendCommands(string id, LovenseCommand[] commands) { foreach (LovenseCommand lovenseCommand in commands) { _SendCommand(id, (int)lovenseCommand.commandType, lovenseCommand.value); } } public void SendCommand(string id, LovenseCommand command) { Plugin.Logger.LogInfo((object)$"Command {command} sent to {id}"); _SendCommand(id, (int)command.commandType, command.value); } public void SendCommandsToSolacePro(string id, LovenseSolaceProCommand command) { _SendCommandToSolacePro(id, command.speedLevel, command.strokeLow, command.strokeHigh); } public void Stop(string id, string toyType) { LovenseCommandType[] supportedCommandsByType = GetSupportedCommandsByType(toyType); if (supportedCommandsByType.Length != 0) { LovenseCommandType[] array = supportedCommandsByType; foreach (LovenseCommandType commandType in array) { LovenseCommand command = new LovenseCommand { commandType = commandType, value = 0 }; SendCommand(id, command); } } } public LovenseCommandType[] GetSupportedCommandsByType(string toyType) { foreach (KeyValuePair<string, ToySupport> item in supportedCommandDic) { if (item.Value.type == toyType) { return item.Value.supported; } } return new LovenseCommandType[0]; } } } namespace LovenseLushController { [HarmonyPatch(typeof(Arena), "CrownGrab")] public class ArenaCrownGrabPatch { [HarmonyPrefix] private static void Prefix(Arena __instance) { if (LovenseSettings.Enabled && LovenseSettings.OnCrownGrabVibrate) { Plugin.VibrateToy(LovenseSettings.RandomizedIntensity ? Random.Range(1, 20) : Convert.ToInt32(LovenseSettings.CrownGrabVibrateIntensity)); Plugin.VibrateStop(); } } } [HarmonyPatch] public class PhotonViewRPCPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PhotonView), "RPC", new Type[3] { typeof(string), typeof(RpcTarget), typeof(object[]) }, (Type[])null); } private static void Prefix(PhotonView __instance, string methodName, RpcTarget target, params object[] parameters) { } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "BreakRPC")] public class PhysGrabObjectImpactDetectorBreakRPCPatch { [HarmonyPrefix] private static void Prefix(PhysGrabObjectImpactDetector __instance, float valueLost, Vector3 _contactPoint, int breakLevel, bool _loseValue, PhotonMessageInfo _info = default(PhotonMessageInfo)) { if (!LovenseSettings.Enabled) { return; } ValuableObject component = ((Component)__instance).GetComponent<ValuableObject>(); if (!((Object)(object)component != (Object)null)) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(ValuableObject), "dollarValueCurrent"); int max = Convert.ToInt32(fieldInfo.GetValue(component)); int value = Convert.ToInt32(valueLost); if (LovenseSettings.TestingMode) { fieldInfo.SetValue(component, 1000000); } if (LovenseSettings.OnBreakVibrate) { Plugin.VibrateToy(LovenseSettings.RandomizedIntensity ? Random.Range(1, 20) : Plugin.Map1to20(value, max)); if (!LovenseSettings.isItemGrabbed) { Plugin.VibrateStop(); } } } } [HarmonyPatch(typeof(PhysGrabObject), "GrabStarted")] public class PhysGrabObjectGrabStartedPatch { [HarmonyPrefix] private static void Prefix(PhysGrabObject __instance, PhysGrabber player) { if (LovenseSettings.Enabled && LovenseSettings.OnGrabStartedVibrate && !LovenseSettings.isItemGrabbed) { Plugin.Logger.LogInfo((object)"PhysGrabObject GrabStarted"); Plugin.VibrateToy(LovenseSettings.RandomizedIntensity ? Random.Range(1, 20) : Convert.ToInt32(LovenseSettings.GrabStartedVibrateIntensity)); LovenseSettings.isItemGrabbed = true; } } } [HarmonyPatch(typeof(PhysGrabObject), "GrabEnded")] public class PhysGrabObjectGrabEndedPatch { [HarmonyPrefix] private static void Prefix(PhysGrabObject __instance, PhysGrabber player) { if (LovenseSettings.Enabled && LovenseSettings.OnGrabStartedVibrate && LovenseSettings.isItemGrabbed) { Plugin.Logger.LogInfo((object)"PhysGrabObject GrabEnded"); Plugin.VibrateStop(); LovenseSettings.isItemGrabbed = false; } } } [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeath")] public class PlayerAvatarPlayerDeathPatch { [HarmonyPrefix] private static void Prefix(PlayerAvatar __instance, int enemyIndex) { if (LovenseSettings.Enabled && LovenseSettings.OnPlayerDeathVibrate) { Plugin.VibrateToy(LovenseSettings.RandomizedIntensity ? Random.Range(1, 20) : Convert.ToInt32(LovenseSettings.PlayerDeathIntensity)); Plugin.VibrateStop(); } } } [HarmonyPatch(typeof(PlayerAvatar), "ReviveRPC")] public class PlayerAvatarReviveRPCPatch { [HarmonyPrefix] private static void Prefix(PlayerAvatar __instance, bool _revivedByTruck, PhotonMessageInfo _info = default(PhotonMessageInfo)) { Plugin.Logger.LogDebug((object)"PlayerAvatar.ReviveRPC patch pre"); } } [HarmonyPatch(typeof(PlayerAvatar), "ChatMessageSendRPC")] public class PlayerAvatarChatMessageSendRPCPatch { [HarmonyPrefix] private static void Prefix(PlayerAvatar __instance, string _message, bool crouching, PhotonMessageInfo _info = default(PhotonMessageInfo)) { Plugin.Logger.LogDebug((object)"PlayerAvatar.ChatMessageSendRPC patch pre"); if (LovenseSettings.Enabled && LovenseSettings.AllowChatBoops && _message.ToLower() == "boop") { Plugin.VibrateToy(LovenseSettings.RandomizedIntensity ? Random.Range(1, 20) : Convert.ToInt32(LovenseSettings.AllowChatBoopsIntensity)); Plugin.VibrateStop(); } } } [BepInPlugin("LovenseLushController", "Repo Lovense Lush Controller", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static List<int> vibrationQueue = new List<int>(); public void Awake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0049: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin LovenseLushController is loaded!"); Logger = ((BaseUnityPlugin)this).Logger; new Harmony("com.Harmony.RepoLib").PatchAll(Assembly.GetExecutingAssembly()); GameObject val = new GameObject("IMGUIOverlay"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<ImGuiBehaviour>(); GetSupportedCommand(); LovenseBLETools.GetInstance().InitCallback(); LovenseBLETools.GetInstance().CheckBLEStatus(); LovenseBLETools.GetInstance().lovenseNotifyEvent += Form1_LovenseNotifyMessage; LovenseBLETools.GetInstance().addToyEvent += Form1_addToyEvent; LovenseBLETools.GetInstance().connectChangeEvent += Form1_connectChangeEvent; LovenseBLETools.GetInstance().eventsAPIevent += Form1_eventsAPIevent; LovenseBLETools.GetInstance().batteryEvent += Form1_eventsBattery; } private void Form1_addToyEvent(LovenseToy toy) { try { LovenseBLETools.GetInstance().StopBLEScan(); LovenseBLETools.GetInstance().ConnectToy(toy.id); } catch (Exception ex) { Logger.LogError((object)ex.Message); } } private void Form1_LovenseNotifyMessage(LovenseNotifyType type, string id) { Logger.LogInfo((object)type.ToString()); } private void Form1_eventsBattery(string id, string battery) { Logger.LogInfo((object)("get Battery:" + id + "," + battery)); } private void Form1_eventsAPIevent(string id, LovenseDataReportingEventType type, int hardwareType, int value) { Logger.LogInfo((object)("get events->" + id + ",event type:" + type.ToString() + ",hardwareType:" + hardwareType + ",value:" + value)); } private void Form1_connectChangeEvent(string id, bool connected) { if (connected) { try { LovenseSettings.ToyId = id; } catch (Exception ex) { Logger.LogError((object)ex.Message); } } Logger.LogInfo((object)("ConnectChanged:" + id + "," + connected)); } public async void GetSupportedCommand() { string supportTextData = ",symbol,type,showName,func\r\n0,1.5,version,,\r\n1,[ \"l\"],Ambi,Ambi,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\r\n \"\r\n2,[ \"ca\"],Mission2,Mission2,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n3,[ \"su\"],c20,C20,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n4,[ \"t\"],Calor,Calor,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n5,[ \"r\"],Diamo,Diamo,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n6,[ \"j\"],Dolce,Dolce,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": true, \"\"v1\"\": true, \"\"v\"\": true}\"\r\n7,[ \"w\"],Domi,Domi,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n8,[ \"p\"],Edge,Edge,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": true, \"\"v1\"\": true, \"\"v\"\": true}\"\r\n9,[ \"ef\"],Exomoon,Exomoon,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n10,[ \"x\"],Ferri,Ferri,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n11,[ \"ei\"],Flexer,Flexer,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true, \"\"f\"\": true}\"\r\n12,[ \"n\"],Gemini,Gemini,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": true, \"\"v1\"\": true, \"\"v\"\": true}\"\r\n13,[ \"ea\"],Gravity,Gravity,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true, \"\"t\"\": true, \"\"s\"\": false}\"\r\n14,[ \"ed\"],Gush,Gush,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n15,[ \"ba\"],SolacePro,SolacePro,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": false, \"\"t\"\": true, \"\"pos\"\": true}\"\r\n16,[ \"z\"],Hush,Hush,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n17,[ \"eb\"],Hyphy,Hyphy,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n18,[ \"u\"],Lapis,Lapis,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": true, \"\"v1\"\": true, \"\"v3\"\": true, \"\"v\"\": true}\"\r\n19,[ \"s\"],Lush,Lush,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n20,\"[ \"\"toyb\"\", \"\"b\"\"]\",Max,Max,\"{ \"\"p\"\": true, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n21,[ \"fs\"],MiniXMachine,MiniXMachine,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true, \"\"t\"\": true}\"\r\n22,[ \"v\"],Mission,Mission,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n23,\"[ \"\"toyc\"\", \"\"toya\"\", \"\"c\"\", \"\"a\"\"]\",Nora,Nora,\"{ \"\"p\"\": false, \"\"r\"\": true, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n24,[ \"o\"],Osci,Osci,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n25,[ \"qa\"],QA01,QA01,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": true, \"\"v1\"\": true, \"\"v\"\": true}\"\r\n26,[ \"el\"],Ridge,Ridge,\"{ \"\"p\"\": false, \"\"r\"\": true, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n27,[ \"h\"],Solace,Solace,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": false, \"\"t\"\": true, \"\"d\"\": true}\"\r\n28,[ \"q\"],Tenera,Tenera,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true, \"\"s\"\": true}\"\r\n29,[ \"sd\"],Vulse,Vulse,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true}\"\r\n30,[ \"f\"],XMachine,XMachine,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": true, \"\"t\"\": true}\"\r\n31,[ \"ez\"],Gush2,Gush2,\"{ \"\"p\"\": false, \"\"r\"\": false, \"\"v2\"\": false, \"\"v1\"\": false, \"\"v\"\": false, \"\"o\"\":true}\""; LovenseBLETools.GetInstance().InitSupport(supportTextData, delegate { }); } public static int Map1to20(int value, int max) { if (max <= 0) { throw new ArgumentException("max must be > 0"); } double num = Math.Clamp((double)value / (double)max, 0.0, 1.0); return Math.Min(Math.Max(1 + (int)Math.Round(num * 19.0, MidpointRounding.AwayFromZero), 1), 20); } public static void VibrateToy(int intensity) { if (!LovenseSettings.Testing && LovenseSettings.HardCoreMode) { intensity = 20; } if (LovenseSettings.isItemGrabbed) { vibrationQueue.Add(intensity); LovenseSettings.isItemGrabbedListEmpty = false; } else if (vibrationQueue.Count != 0) { vibrationQueue.Add(intensity); LovenseSettings.isItemGrabbedListEmpty = false; } else if (!LovenseSettings.Testing) { LovenseBLETools.GetInstance().SendCommand(LovenseSettings.ToyId, new LovenseCommand { commandType = LovenseCommandType.VIBRATE, value = intensity }); } Logger.LogInfo((object)$"Plugin.VibrateToy({intensity})"); } public static void VibrateStop() { if (!LovenseSettings.Testing) { LovenseBLETools.GetInstance().SendCommand(LovenseSettings.ToyId, new LovenseCommand { commandType = LovenseCommandType.VIBRATE, value = 0 }); } } } public class ImGuiBehaviour : MonoBehaviour { private bool showMenu; private Rect windowRect = new Rect(20f, 20f, 380f, 240f); private bool resizing; private Vector2 resizeStartMouse; private Vector2 resizeStartSize; public void RunQueue() { if (LovenseSettings.isItemGrabbed) { return; } LovenseSettings.isItemGrabbedTick++; if ((float)LovenseSettings.isItemGrabbedTick <= LovenseSettings.isItemGrabbedTickMax) { return; } LovenseSettings.isItemGrabbedTick = 0; if (Plugin.vibrationQueue.Count > 0) { int num = Plugin.vibrationQueue[0]; Plugin.vibrationQueue.RemoveAt(0); if (LovenseSettings.Enabled) { Plugin.Logger.LogInfo((object)$"Queued Vibrate {num}"); if (!LovenseSettings.Testing) { LovenseBLETools.GetInstance().SendCommand(LovenseSettings.ToyId, new LovenseCommand { commandType = LovenseCommandType.VIBRATE, value = num }); } } } else if (!LovenseSettings.isItemGrabbedListEmpty) { Plugin.Logger.LogInfo((object)"Queued Vibrate 0"); if (!LovenseSettings.Testing) { LovenseBLETools.GetInstance().SendCommand(LovenseSettings.ToyId, new LovenseCommand { commandType = LovenseCommandType.VIBRATE, value = 0 }); } LovenseSettings.isItemGrabbedListEmpty = true; } } public void OnGUI() { //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Invalid comparison between Unknown and I4 //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Invalid comparison between Unknown and I4 //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Invalid comparison between Unknown and I4 //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) if (!LovenseSettings.isItemGrabbed) { if (LovenseSettings.isItemGrabbedTick > (int)LovenseSettings.isItemGrabbedTickMax) { if (Plugin.vibrationQueue.Count >= 1) { int num = Plugin.vibrationQueue[0]; if (LovenseSettings.Enabled) { Plugin.Logger.LogInfo((object)$"Queued Vibrate {num}"); if (!LovenseSettings.Testing) { LovenseBLETools.GetInstance().SendCommand(LovenseSettings.ToyId, new LovenseCommand { commandType = LovenseCommandType.VIBRATE, value = num }); } } Plugin.vibrationQueue.RemoveAt(0); } else if (!LovenseSettings.isItemGrabbedListEmpty) { Plugin.Logger.LogInfo((object)"Queued Vibrate 0"); if (!LovenseSettings.Testing) { LovenseBLETools.GetInstance().SendCommand(LovenseSettings.ToyId, new LovenseCommand { commandType = LovenseCommandType.VIBRATE, value = 0 }); } LovenseSettings.isItemGrabbedListEmpty = true; } LovenseSettings.isItemGrabbedTick = 0; } LovenseSettings.isItemGrabbedTick++; } if (Object.op_Implicit((Object)(object)PlayerController.instance) && Object.op_Implicit((Object)(object)PlayerController.instance.playerAvatarScript) && Object.op_Implicit((Object)(object)PlayerController.instance.playerAvatarScript.playerHealth)) { if (LovenseSettings.TestingMode) { AccessTools.Field(typeof(PlayerHealth), "godMode").SetValue(PlayerController.instance.playerAvatarScript.playerHealth, true); PlayerController.instance.EnergyCurrent = 100f; } else { AccessTools.Field(typeof(PlayerHealth), "godMode").SetValue(PlayerController.instance.playerAvatarScript.playerHealth, false); } } if ((int)Event.current.type == 4) { KeyCode keyCode = Event.current.keyCode; if ((int)keyCode != 282) { if ((int)keyCode == 283) { LovenseSettings.ToyId = "testing toy"; LovenseSettings.Testing = true; } else if (LovenseSettings.DebugKeys) { KeyCode keyCode2 = Event.current.keyCode; Debug.Log((object)("Key down: " + ((object)(KeyCode)(ref keyCode2)).ToString())); } } else { showMenu = !showMenu; } } if (showMenu) { Cursor.visible = true; } else { Cursor.visible = false; } GUILayout.TextArea($"F1 For Lovense Toy Control - Build {151}", Array.Empty<GUILayoutOption>()); if (showMenu) { windowRect = GUI.Window(123456, windowRect, new WindowFunction(DrawWindow), $"Lovense Toy Control - Build {151}"); } } public void DumpGameObject(string name) { GameObject val = GameObject.Find(name); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogInfo((object)("GameObject '" + name + "' not found.")); return; } Plugin.Logger.LogInfo((object)("--- Dumping Components of GameObject: " + ((Object)val).name + " ---")); Component[] components = val.GetComponents<Component>(); foreach (Component val2 in components) { if ((Object)(object)val2 == (Object)null) { continue; } Type type = ((object)val2).GetType(); Plugin.Logger.LogInfo((object)("Component: " + type.FullName)); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { try { object value = fieldInfo.GetValue(val2); Plugin.Logger.LogInfo((object)$" Field {fieldInfo.Name} = {value}"); } catch { } } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead) { try { object value2 = propertyInfo.GetValue(val2, null); Plugin.Logger.LogInfo((object)$" Prop {propertyInfo.Name} = {value2}"); } catch { } } } } Plugin.Logger.LogInfo((object)("--- Done dumping " + ((Object)val).name + " ---")); } public bool ShouldShow() { return true; } public void DrawWindow(int windowID) { //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Invalid comparison between Unknown and I4 //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); LovenseSettings.DebugKeys = GUILayout.Toggle(LovenseSettings.DebugKeys, "Enable Debug", Array.Empty<GUILayoutOption>()); LovenseSettings.Enabled = GUILayout.Toggle(LovenseSettings.Enabled, "Enable Lovense Usage", Array.Empty<GUILayoutOption>()); if (LovenseSettings.Enabled) { if (string.IsNullOrEmpty(LovenseSettings.ToyId)) { if (GUILayout.Button("Scan For Toys", Array.Empty<GUILayoutOption>())) { if (!LovenseSettings.Scanning) { LovenseBLETools.GetInstance().StartBLEScan(); LovenseSettings.Scanning = true; } else { Plugin.Logger.LogInfo((object)"Already scanning bluetooth devices for Lovense Toys!"); } } if (LovenseSettings.Scanning && GUILayout.Button("Stop Scan", Array.Empty<GUILayoutOption>())) { LovenseBLETools.GetInstance().StopBLEScan(); LovenseSettings.Scanning = false; } } else { GUILayout.Label("Toy Connected: " + LovenseSettings.ToyId, Array.Empty<GUILayoutOption>()); if (LovenseSettings.DebugKeys) { LovenseSettings.TestingMode = GUILayout.Toggle(LovenseSettings.TestingMode, "Testing Mode", Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Add 10 Health", Array.Empty<GUILayoutOption>()) && Object.op_Implicit((Object)(object)PlayerController.instance) && Object.op_Implicit((Object)(object)PlayerController.instance.playerAvatarScript) && Object.op_Implicit((Object)(object)PlayerController.instance.playerAvatarScript.playerHealth)) { PlayerController.instance.playerAvatarScript.playerHealth.Heal(10, false); } if (GUILayout.Button("Find Class Parent Object", Array.Empty<GUILayoutOption>())) { DumpGameObject("Menu Page Settings(Clone)"); } GUILayout.Button("Test Menu", Array.Empty<GUILayoutOption>()); } LovenseSettings.HardCoreMode = GUILayout.Toggle(LovenseSettings.HardCoreMode, "Hardcore Mode", Array.Empty<GUILayoutOption>()); LovenseSettings.RandomizedIntensity = GUILayout.Toggle(LovenseSettings.RandomizedIntensity, "Randomized Intensity", Array.Empty<GUILayoutOption>()); LovenseSettings.OnBreakVibrate = GUILayout.Toggle(LovenseSettings.OnBreakVibrate, "OnBreak Vibrate", Array.Empty<GUILayoutOption>()); LovenseSettings.OnPlayerDeathVibrate = GUILayout.Toggle(LovenseSettings.OnPlayerDeathVibrate, "Death Vibrate", Array.Empty<GUILayoutOption>()); if (LovenseSettings.OnPlayerDeathVibrate && ShouldShow()) { GUILayout.Label($"Death Intensity {Convert.ToInt32(LovenseSettings.PlayerDeathIntensity)}", Array.Empty<GUILayoutOption>()); LovenseSettings.PlayerDeathIntensity = GUILayout.HorizontalSlider(LovenseSettings.PlayerDeathIntensity, 0f, 20f, Array.Empty<GUILayoutOption>()); } LovenseSettings.OnGrabStartedVibrate = GUILayout.Toggle(LovenseSettings.OnGrabStartedVibrate, "Grab Start Vibrate", Array.Empty<GUILayoutOption>()); if (LovenseSettings.OnGrabStartedVibrate && ShouldShow()) { GUILayout.Label($"Grab Start Intensity {Convert.ToInt32(LovenseSettings.GrabStartedVibrateIntensity)}", Array.Empty<GUILayoutOption>()); LovenseSettings.GrabStartedVibrateIntensity = GUILayout.HorizontalSlider(LovenseSettings.GrabStartedVibrateIntensity, 0f, 20f, Array.Empty<GUILayoutOption>()); } LovenseSettings.OnCrownGrabVibrate = GUILayout.Toggle(LovenseSettings.OnCrownGrabVibrate, "Crown Grab Vibrate", Array.Empty<GUILayoutOption>()); if (LovenseSettings.OnCrownGrabVibrate && ShouldShow()) { GUILayout.Label($"Crown Grab Intensity {Convert.ToInt32(LovenseSettings.CrownGrabVibrateIntensity)}", Array.Empty<GUILayoutOption>()); LovenseSettings.CrownGrabVibrateIntensity = GUILayout.HorizontalSlider(LovenseSettings.CrownGrabVibrateIntensity, 0f, 20f, Array.Empty<GUILayoutOption>()); } LovenseSettings.AllowChatBoops = GUILayout.Toggle(LovenseSettings.AllowChatBoops, "Chat Boop Vibrate", Array.Empty<GUILayoutOption>()); if (LovenseSettings.AllowChatBoops && ShouldShow()) { GUILayout.Label($"Chat Boop Intensity {Convert.ToInt32(LovenseSettings.AllowChatBoopsIntensity)}", Array.Empty<GUILayoutOption>()); LovenseSettings.AllowChatBoopsIntensity = GUILayout.HorizontalSlider(LovenseSettings.AllowChatBoopsIntensity, 0f, 20f, Array.Empty<GUILayoutOption>()); } GUILayout.Label($"Item Grab Tick {Convert.ToInt32(LovenseSettings.isItemGrabbedTickMax)}", Array.Empty<GUILayoutOption>()); LovenseSettings.isItemGrabbedTickMax = GUILayout.HorizontalSlider(LovenseSettings.isItemGrabbedTickMax, 1f, 10000f, Array.Empty<GUILayoutOption>()); } } Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref windowRect)).width - 17f, ((Rect)(ref windowRect)).height - 17f, 15f, 15f); GUI.Box(val, ""); if ((int)Event.current.type == 0 && ((Rect)(ref val)).Contains(Event.current.mousePosition)) { resizing = true; resizeStartMouse = Event.current.mousePosition; resizeStartSize = new Vector2(((Rect)(ref windowRect)).width, ((Rect)(ref windowRect)).height); Event.current.Use(); } if ((int)Event.current.type == 1) { resizing = false; } if (resizing) { Vector2 val2 = Event.current.mousePosition - resizeStartMouse; ((Rect)(ref windowRect)).width = Mathf.Max(100f, resizeStartSize.x + val2.x); ((Rect)(ref windowRect)).height = Mathf.Max(50f, resizeStartSize.y + val2.y); } GUILayout.EndVertical(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } } public class LovenseSettings { public static string ToyId = ""; public static bool Testing; public static bool DebugKeys; public static bool Enabled; public static bool Scanning; public static bool TeaseMode; public static bool HardCoreMode; public static bool SelfControlOnly; public static bool TestingMode; public static bool RandomizedIntensity; public static bool OnBreakVibrate; public static bool OnHealOthersVibrate; public static float HealOthersIntensity; public static bool OnPlayerDeathVibrate; public static float PlayerDeathIntensity; public static bool OnGrabStartedVibrate; public static float GrabStartedVibrateIntensity; public static bool isItemGrabbed; public static int isItemGrabbedTick; public static float isItemGrabbedTickMax = 1000f; public static bool isItemGrabbedListEmpty; public static bool OnCrownGrabVibrate; public static float CrownGrabVibrateIntensity; public static bool AllowChatBoops; public static float AllowChatBoopsIntensity; } public static class MyPluginInfo { public const string PLUGIN_GUID = "LovenseLushController"; public const string PLUGIN_NAME = "Repo Lovense Lush Controller"; public const string PLUGIN_VERSION = "1.0.0"; } }