using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.CRotater.3924")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+42ba2ab578d29be54697081a2213efb25bb9d326")]
[assembly: AssemblyProduct("CRotater")]
[assembly: AssemblyTitle("Character Rotater")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[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 Character_Rotater
{
public static class CommandParser
{
public static void HandleCommand(string[] args)
{
if (args.Length < 1)
{
PrintHelp();
return;
}
switch (args[0].ToLower())
{
case "toggle":
Main.rotatorEnabled = !Main.rotatorEnabled;
LogChatMessage("Rotator " + (Main.rotatorEnabled ? "Enabled" : "Disabled") + ".");
break;
case "mode":
HandleModeCommand(args);
break;
case "set":
HandleSetCommand(args);
break;
case "reset":
Main.ResetSettingsToDefault();
LogChatMessage("Rotation values have been reset to their defaults.");
break;
default:
PrintHelp();
break;
}
}
private static void HandleModeCommand(string[] args)
{
if (args.Length > 1 && (args[1].ToLower() == "static" || args[1].ToLower() == "rotating"))
{
Main.isStatic = args[1].ToLower() == "static";
LogChatMessage("Rotator mode set to " + (Main.isStatic ? "Static" : "Rotating") + ".");
}
else
{
LogChatMessage("Usage: /rotator mode <static|rotating>");
}
}
private static void HandleSetCommand(string[] args)
{
if (args.Length < 2)
{
LogChatMessage("Usage: /rotator set <axis><value> OR /rotator set <x> <y> <z>");
return;
}
if (args.Length > 3 && TryParseValue(args[1], Main.rotationValueX, out var result) && TryParseValue(args[2], Main.rotationValueY, out var result2) && TryParseValue(args[3], Main.rotationValueZ, out var result3))
{
Main.rotationValueX = result;
Main.rotationValueY = result2;
Main.rotationValueZ = result3;
LogChatMessage($"Rotation set to X:{result:F0}, Y:{result2:F0}, Z:{result3:F0}.");
return;
}
bool flag = false;
for (int i = 1; i < args.Length; i++)
{
string text = args[i].ToLower();
char c = text[0];
string text2 = text.Substring(1);
if (string.IsNullOrEmpty(text2) && i + 1 < args.Length)
{
text2 = args[i + 1];
i++;
}
switch (c)
{
case 'x':
{
if (TryParseValue(text2, Main.rotationValueX, out var result5))
{
Main.rotationValueX = result5;
flag = true;
}
break;
}
case 'y':
{
if (TryParseValue(text2, Main.rotationValueY, out var result6))
{
Main.rotationValueY = result6;
flag = true;
}
break;
}
case 'z':
{
if (TryParseValue(text2, Main.rotationValueZ, out var result4))
{
Main.rotationValueZ = result4;
flag = true;
}
break;
}
}
}
if (flag)
{
LogChatMessage($"Current rotation: X:{Main.rotationValueX:F0}, Y:{Main.rotationValueY:F0}, Z:{Main.rotationValueZ:F0}.");
}
else
{
LogChatMessage("Invalid format. Use `/rotator set x<val> y<val>...`");
}
}
private static bool TryParseValue(string input, float currentValue, out float result)
{
input = input.Trim();
result = currentValue;
if (string.IsNullOrEmpty(input))
{
return false;
}
float result4;
if (input.StartsWith("+"))
{
if (float.TryParse(input.Substring(1), out var result2))
{
result = Mathf.Clamp(currentValue + result2, -360f, 360f);
return true;
}
}
else if (input.StartsWith("-"))
{
if (float.TryParse(input, out var result3))
{
result = Mathf.Clamp(currentValue + result3, -360f, 360f);
return true;
}
}
else if (float.TryParse(input, out result4))
{
result = Mathf.Clamp(result4, -360f, 360f);
return true;
}
return false;
}
private static void LogChatMessage(string message)
{
Player mainPlayer = Player._mainPlayer;
if (mainPlayer != null)
{
ChatBehaviour chatBehaviour = mainPlayer._chatBehaviour;
if (chatBehaviour != null)
{
chatBehaviour.New_ChatMessage("<color=#00FFFF>[Rotator]</color> " + message);
}
}
}
private static void PrintHelp()
{
LogChatMessage("--- Character Rotator Help ---");
LogChatMessage("/rotator toggle - Toggles the rotator on/off.");
LogChatMessage("/rotator mode <static|rotating>");
LogChatMessage("/rotator set <x/y/z><value> - e.g., /rot set y90 x+10");
LogChatMessage("/rotator reset - Resets all rotation values to default.");
}
}
[BepInPlugin("com.s0apy.CRotater", "CRotater", "1.0.4")]
public class Main : BaseUnityPlugin
{
internal static ManualLogSource Log;
private readonly Harmony harmony = new Harmony("com.s0apy.CRotater");
internal static ConfigEntry<bool> configRotatorEnabled;
internal static ConfigEntry<bool> configIsStatic;
internal static ConfigEntry<float> configRotationValueX;
internal static ConfigEntry<float> configRotationValueY;
internal static ConfigEntry<float> configRotationValueZ;
internal static ConfigEntry<KeyCode> configToggleMenuKey;
private bool showMenu = false;
private Rect windowRect = new Rect(20f, 20f, 300f, 250f);
private readonly int windowId = new Random().Next(1000, 9999);
internal static readonly DateTime EndOfSupportUtc = new DateTime(2026, 11, 30, 0, 0, 0, DateTimeKind.Utc);
private const string DevPing = "@runeaphobia";
private const string DevContact = "ping @runeaphobia in the Atlyss Modding Central or runem0dz Discord server";
private const string RunemodzInvite = "https://discord.gg/ePhX4Fb2we";
private const string ModdingCentralInvite = "https://discord.gg/CqdS3aZJZn";
private const string NotifyChannelUrl = "https://discord.com/channels/1395549829962137690/1395556467083575447";
private bool expiredHandled = false;
private Rect noticeRect;
public static bool rotatorEnabled
{
get
{
return configRotatorEnabled.Value;
}
set
{
configRotatorEnabled.Value = value;
}
}
public static bool isStatic
{
get
{
return configIsStatic.Value;
}
set
{
configIsStatic.Value = value;
}
}
public static float rotationValueX
{
get
{
return configRotationValueX.Value;
}
set
{
configRotationValueX.Value = value;
}
}
public static float rotationValueY
{
get
{
return configRotationValueY.Value;
}
set
{
configRotationValueY.Value = value;
}
}
public static float rotationValueZ
{
get
{
return configRotationValueZ.Value;
}
set
{
configRotationValueZ.Value = value;
}
}
internal static bool IsExpired => DateTime.UtcNow >= EndOfSupportUtc;
private void HandleExpiry()
{
expiredHandled = true;
configRotatorEnabled.Value = false;
harmony.UnpatchSelf();
Log.LogError((object)string.Format("[{0} v{1}] This mod is DEPRECATED. It reached End of Support on {2:yyyy-MM-dd HH:mm} UTC and has been disabled.", "CRotater", "1.0.4", EndOfSupportUtc));
Log.LogError((object)"[CRotater] To avoid conflicts in the future, it MUST be uninstalled: delete the Character Rotater .dll from BepInEx/plugins.");
Log.LogError((object)"[CRotater] Please also notify the developer: ping @runeaphobia in the Atlyss Modding Central or runem0dz Discord server. Channel: https://discord.com/channels/1395549829962137690/1395556467083575447");
}
private void DrawExpiryNotice(int id)
{
GUILayout.Label("This mod has reached its End of Support date and no longer functions.", Array.Empty<GUILayoutOption>());
GUILayout.Space(8f);
GUILayout.Label("Please REMOVE it (delete the Character Rotater .dll from BepInEx/plugins).", Array.Empty<GUILayoutOption>());
GUILayout.Space(8f);
GUILayout.Label("You must also notify the developer: ping @runeaphobia in the notification channel of the Atlyss Modding Central server (or the runem0dz server) to confirm you've seen this notice.", Array.Empty<GUILayoutOption>());
GUILayout.Space(8f);
if (GUILayout.Button("Open notification channel (Atlyss Modding Central)", Array.Empty<GUILayoutOption>()))
{
Application.OpenURL("https://discord.com/channels/1395549829962137690/1395556467083575447");
}
if (GUILayout.Button("Join Atlyss Modding Central", Array.Empty<GUILayoutOption>()))
{
Application.OpenURL("https://discord.gg/CqdS3aZJZn");
}
if (GUILayout.Button("Join runem0dz", Array.Empty<GUILayoutOption>()))
{
Application.OpenURL("https://discord.gg/ePhX4Fb2we");
}
if (GUILayout.Button("Copy @runeaphobia to clipboard", Array.Empty<GUILayoutOption>()))
{
GUIUtility.systemCopyBuffer = "@runeaphobia";
}
GUI.DragWindow();
}
private void Awake()
{
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
configRotatorEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "Enabled", false, "Enable or disable the character rotator.");
configIsStatic = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "StaticMode", false, "If true, sets a static rotation angle. If false, character spins continuously.");
configToggleMenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("2. Controls", "ToggleMenuKey", (KeyCode)277, "The key to press to show/hide the rotator menu.");
configRotationValueX = ((BaseUnityPlugin)this).Config.Bind<float>("3. Rotation", "ValueX", 0f, "Rotation Speed (if not static) or Angle (if static) on the X-axis.");
configRotationValueY = ((BaseUnityPlugin)this).Config.Bind<float>("3. Rotation", "ValueY", 100f, "Rotation Speed (if not static) or Angle (if static) on the Y-axis.");
configRotationValueZ = ((BaseUnityPlugin)this).Config.Bind<float>("3. Rotation", "ValueZ", 0f, "Rotation Speed (if not static) or Angle (if static) on the Z-axis.");
if (IsExpired)
{
HandleExpiry();
return;
}
harmony.PatchAll();
int num = (int)(EndOfSupportUtc - DateTime.UtcNow).TotalDays;
Log.LogInfo((object)string.Format("[{0} v{1}] loaded. Support ends in {2} day(s). Press '{3}' to open the menu.", "CRotater", "1.0.4", num, configToggleMenuKey.Value));
}
public static void ResetSettingsToDefault()
{
isStatic = (bool)((ConfigEntryBase)configIsStatic).DefaultValue;
rotationValueX = (float)((ConfigEntryBase)configRotationValueX).DefaultValue;
rotationValueY = (float)((ConfigEntryBase)configRotationValueY).DefaultValue;
rotationValueZ = (float)((ConfigEntryBase)configRotationValueZ).DefaultValue;
}
private void Update()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if (!expiredHandled && IsExpired)
{
HandleExpiry();
}
if (!expiredHandled && Input.GetKeyDown(configToggleMenuKey.Value))
{
showMenu = !showMenu;
}
}
private void OnGUI()
{
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Expected O, but got Unknown
//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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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_0056: Unknown result type (might be due to invalid IL or missing references)
if (expiredHandled)
{
if (((Rect)(ref noticeRect)).width == 0f)
{
noticeRect = new Rect((float)(Screen.width - 460) / 2f, (float)(Screen.height - 340) / 2f, 460f, 340f);
}
noticeRect = GUI.Window(windowId + 1, noticeRect, new WindowFunction(DrawExpiryNotice), "Character Rotater - End of Support");
}
else if (showMenu)
{
windowRect = GUI.Window(windowId, windowRect, new WindowFunction(DrawWindow), "Character Rotator");
}
}
private void DrawWindow(int id)
{
rotatorEnabled = GUILayout.Toggle(rotatorEnabled, "Enable Rotator", Array.Empty<GUILayoutOption>());
isStatic = GUILayout.Toggle(isStatic, "Static Mode", Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
string arg = (isStatic ? "Angle" : "Speed");
GUILayout.Label($"X-Axis {arg}: {rotationValueX:F0}", Array.Empty<GUILayoutOption>());
rotationValueX = GUILayout.HorizontalSlider(rotationValueX, -360f, 360f, Array.Empty<GUILayoutOption>());
GUILayout.Label($"Y-Axis {arg}: {rotationValueY:F0}", Array.Empty<GUILayoutOption>());
rotationValueY = GUILayout.HorizontalSlider(rotationValueY, -360f, 360f, Array.Empty<GUILayoutOption>());
GUILayout.Label($"Z-Axis {arg}: {rotationValueZ:F0}", Array.Empty<GUILayoutOption>());
rotationValueZ = GUILayout.HorizontalSlider(rotationValueZ, -360f, 360f, Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
if (GUILayout.Button("Reset to Defaults", Array.Empty<GUILayoutOption>()))
{
ResetSettingsToDefault();
}
GUI.DragWindow();
}
}
internal static class ModInfo
{
public const string GUID = "com.s0apy.CRotater";
public const string NAME = "CRotater";
public const string VERSION = "1.0.4";
}
}
namespace Character_Rotater.Patches
{
[HarmonyPatch(typeof(ChatBehaviour), "Cmd_SendChatMessage")]
internal class ChatPatch
{
[HarmonyPrefix]
public static bool InterceptChatCommands(string _message)
{
if (Main.IsExpired)
{
return true;
}
string text = _message.Trim();
if (text.StartsWith("/rotator") || text.StartsWith("/rot"))
{
string[] array = text.Split(' ');
string[] array2 = new string[array.Length - 1];
for (int i = 1; i < array.Length; i++)
{
array2[i - 1] = array[i];
}
CommandParser.HandleCommand(array2);
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Player))]
internal class RotationPatch
{
[HarmonyPostfix]
[HarmonyPatch("Update")]
public static void OverrideRotation(Player __instance)
{
//IL_0069: 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_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_008b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)(object)Player._mainPlayer && Main.rotatorEnabled && !Main.IsExpired)
{
Quaternion rotation = ((!Main.isStatic) ? Quaternion.Euler(Time.time * Main.rotationValueX, Time.time * Main.rotationValueY, Time.time * Main.rotationValueZ) : Quaternion.Euler(Main.rotationValueX, Main.rotationValueY, Main.rotationValueZ));
NetworkTransformUnreliable netTransform = __instance._netTransform;
if ((Object)(object)netTransform != (Object)null)
{
((Component)netTransform).transform.rotation = rotation;
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}