using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BaboonAPI.Hooks.Initializer;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using TootTally.Utils;
using TootTally.Utils.Helpers;
using TootTally.Utils.TootTallySettings;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TootTally.WickedCursorMovement2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("TootTally Module version of WickedCursorMovement")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("TootTally.WickedCursorMovement2")]
[assembly: AssemblyTitle("TootTally.WickedCursorMovement2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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 TootTally.WickedCursorMovement2
{
[BepInPlugin("TootTally.WickedCursorMovement2", "TootTally.WickedCursorMovement2", "2.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin, ITootTallyModule
{
public static class WickedCursorMovementPatches
{
public static SecondOrderDynamics cursorDynamics;
public static Vector2 cursorPosition;
public static Vector2 cursorDestination;
[HarmonyPatch(typeof(GameController), "Start")]
[HarmonyPostfix]
public static void GameControllerStartPostfixPatch(GameController __instance)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
cursorDynamics = new SecondOrderDynamics(Instance.option.Frequency.Value, Instance.option.Damping.Value, Instance.option.InitialResponse.Value);
cursorPosition = Vector2.op_Implicit(__instance.pointer.transform.localPosition);
cursorDynamics.SetStartVector(Vector2.op_Implicit(cursorPosition));
}
[HarmonyPatch(typeof(GameController), "Update")]
[HarmonyPrefix]
public static void GameControllerUpdatePostfixPatch(GameController __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
cursorDestination = Vector2.op_Implicit(Input.mousePosition / 2.42f);
cursorDestination.y -= 220f;
if (cursorDynamics != null && cursorPosition != cursorDestination)
{
cursorPosition.y = cursorDynamics.GetNewVector(Vector2.op_Implicit(cursorDestination), Time.deltaTime).y;
}
__instance.pointer.transform.localPosition = Vector2.op_Implicit(cursorPosition);
}
}
public class Options
{
public ConfigEntry<float> Frequency { get; set; }
public ConfigEntry<float> Damping { get; set; }
public ConfigEntry<float> InitialResponse { get; set; }
}
public static Plugin Instance;
private const string CONFIG_NAME = "WickedCursorMovement.cfg";
private const string CONFIG_FIELD = "WickedCursorMovement";
private const float DEFAULT_FREQ = 3.5f;
private const float DEFAULT_DAMP = 0.12f;
private const float DEFAULT_INIT = 1.5f;
public Options option;
public static TootTallySettingPage settingPage;
public ConfigEntry<bool> ModuleConfigEnabled { get; set; }
public bool IsConfigInitialized { get; set; }
public string Name
{
get
{
return "TootTally.WickedCursorMovement2";
}
set
{
Name = value;
}
}
public ManualLogSource GetLogger => ((BaseUnityPlugin)this).Logger;
public void LogInfo(string msg)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)msg);
}
public void LogError(string msg)
{
((BaseUnityPlugin)this).Logger.LogError((object)msg);
}
private void Awake()
{
if (!((Object)(object)Instance != (Object)null))
{
Instance = this;
GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize);
}
}
private void TryInitialize()
{
ModuleConfigEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Modules", "WickedCursorMovementV2", true, "TootTally Module version of WickedCursorMovement.");
Plugin.AddModule((ITootTallyModule)(object)this);
}
public void LoadModule()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(Paths.BepInExRootPath, "config/");
ConfigFile val = new ConfigFile(text + "WickedCursorMovement.cfg", true);
option = new Options
{
Frequency = val.Bind<float>("WickedCursorMovement", "Frequency", 3.5f, "The strenght of the vibration (Higher vibrates more)."),
Damping = val.Bind<float>("WickedCursorMovement", "Damping", 0.12f, "How fast the cursor settle at the original target.\n(0 will vibrate forever, 100 will not vibrate)."),
InitialResponse = val.Bind<float>("WickedCursorMovement", "InitialResponse", 1.5f, "How much it anticipates the motion.\n(value higher than one will take time to accelerate, value lower than 0 will ancitipate the motion).")
};
settingPage = TootTallySettingsManager.AddNewPage("WickedCursor\nMovementV2", "Wicked Cursor", 40f, new Color(0f, 0f, 0f, 0f));
TootTallySettingPage obj = settingPage;
if (obj != null)
{
obj.AddSlider("Frequency", 0.01f, 10f, option.Frequency, false);
}
TootTallySettingPage obj2 = settingPage;
if (obj2 != null)
{
obj2.AddSlider("Damping", 0f, 10f, option.Damping, false);
}
TootTallySettingPage obj3 = settingPage;
if (obj3 != null)
{
obj3.AddSlider("Initial Response", -10f, 10f, option.InitialResponse, false);
}
settingPage.AddLabel($"Some good default values are:\nFreq: {3.5f}\nDamp: {0.12f}\nInit: {1.5f}", (FontStyles)0, (TextAlignmentOptions)4097);
settingPage.AddLabel("To turn off the effect, go to the TootTally Module's page and turn off the module.", (FontStyles)0, (TextAlignmentOptions)4097);
Harmony.CreateAndPatchAll(typeof(WickedCursorMovementPatches), "TootTally.WickedCursorMovement2");
LogInfo("Module loaded!");
}
public void UnloadModule()
{
Harmony.UnpatchID("TootTally.WickedCursorMovement2");
settingPage.Remove();
LogInfo("Module unloaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TootTally.WickedCursorMovement2";
public const string PLUGIN_NAME = "TootTally.WickedCursorMovement2";
public const string PLUGIN_VERSION = "2.0.0";
}
}