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 WZC ItemRotationControl v1.0.1
plugins\WZC_ItemRotationControl.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("WZC_ItemRotationControl")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+70611518fa3143f4aa80ce8124c8943cc7dc9dc4")] [assembly: AssemblyProduct("WZC_ItemRotationControl")] [assembly: AssemblyTitle("WZC_ItemRotationControl")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } [BepInPlugin("wzc.repo.item_rotation_control", "A.WZC_ItemRotationControl", "1.0.1")] public sealed class WzcItemRotationControlPlugin : BaseUnityPlugin { public const string PluginGuid = "wzc.repo.item_rotation_control"; public const string PluginVersion = "1.0.1"; public const string PluginName = "A.WZC_ItemRotationControl"; private const string ContactConfigSection = "模组信息"; private const string RotationConfigSection = "A.物品旋转控制"; private ConfigEntry<string> moduleNameInfo; private ConfigEntry<string> moduleVersionInfo; private ConfigEntry<string> contactInfo; private static ConfigEntry<bool> rotationControlEnabled; private static ConfigEntry<bool> invertItemRotationHorizontal; private static ConfigEntry<bool> invertItemRotationVertical; private static ConfigEntry<float> itemRotationSensitivity; private static int itemRotationInputDepth; private Harmony harmony; private void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown MakePluginHostPersistent(); moduleNameInfo = ((BaseUnityPlugin)this).Config.Bind<string>("模组信息", "模组名称", "WZC_物品旋转控制", new ConfigDescription("当前模组的中文名称。此处只是提示,不影响功能。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 1000, CustomDrawer = DrawContactInfo, ReadOnly = true } })); moduleNameInfo.Value = "WZC_物品旋转控制"; moduleVersionInfo = ((BaseUnityPlugin)this).Config.Bind<string>("模组信息", "模组版本号", "1.0.1", new ConfigDescription("当前模组版本号。此处只是提示,不影响功能。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 990, CustomDrawer = DrawContactInfo, ReadOnly = true } })); moduleVersionInfo.Value = "1.0.1"; contactInfo = ((BaseUnityPlugin)this).Config.Bind<string>("模组信息", "REPO交流QQ群", "824639225", new ConfigDescription("REPO游戏交流、BUG反馈、优化建议、功能请求请加QQ群。此处只是提示,不影响功能。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 980, CustomDrawer = DrawContactInfo, ReadOnly = true } })); contactInfo.Value = "824639225"; rotationControlEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("A.物品旋转控制", "启用", true, ConfigDescriptionWithOrder("开启后才会修改按住右键旋转物品时的鼠标输入。", 900)); invertItemRotationHorizontal = ((BaseUnityPlugin)this).Config.Bind<bool>("A.物品旋转控制", "反转左右旋转", true, ConfigDescriptionWithOrder("开启后按住右键旋转物品时,鼠标左右方向会反过来。", 890)); invertItemRotationVertical = ((BaseUnityPlugin)this).Config.Bind<bool>("A.物品旋转控制", "反转上下旋转", true, ConfigDescriptionWithOrder("开启后按住右键旋转物品时,鼠标上下方向会反过来。", 880)); itemRotationSensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("A.物品旋转控制", "旋转灵敏度/倍率", 1f, ConfigDescriptionWithOrder("按住右键旋转物品时的鼠标灵敏度倍率。1.0 为原版速度。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), 870)); ApplyItemRotationPatch(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"wzc_item_rotation_control loaded."); } private void OnDestroy() { if (harmony != null) { harmony.UnpatchSelf(); harmony = null; } } private void ApplyItemRotationPatch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b0: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown try { harmony = new Harmony("wzc.repo.item_rotation_control.patch"); MethodInfo methodInfo = AccessTools.Method(typeof(PhysGrabber), "ObjectTurning", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Input), "GetAxis", new Type[1] { typeof(string) }, (Type[])null); if (methodInfo == null || methodInfo2 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to find item rotation input methods."); return; } harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(WzcItemRotationControlPlugin), "BeginItemRotationInputPatch", (Type[])null), new HarmonyMethod(typeof(WzcItemRotationControlPlugin), "EndItemRotationInputPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(WzcItemRotationControlPlugin), "InputGetAxisPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Item rotation controls patched."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Failed to patch item rotation controls: {arg}"); } } private static void BeginItemRotationInputPatch() { itemRotationInputDepth++; } private static void EndItemRotationInputPatch() { itemRotationInputDepth = Math.Max(0, itemRotationInputDepth - 1); } private static void InputGetAxisPostfix(string axisName, ref float __result) { if (itemRotationInputDepth > 0 && rotationControlEnabled != null && rotationControlEnabled.Value && (string.Equals(axisName, "Mouse X", StringComparison.OrdinalIgnoreCase) || string.Equals(axisName, "Mouse Y", StringComparison.OrdinalIgnoreCase))) { __result = AdjustItemRotationAxis(__result, axisName); } } internal static float AdjustItemRotationAxis(float value, string axisName) { float num = ((itemRotationSensitivity == null) ? 1f : Mathf.Clamp(itemRotationSensitivity.Value, 0.1f, 3f)); float num2 = value * num; if (string.Equals(axisName, "Mouse X", StringComparison.OrdinalIgnoreCase) && invertItemRotationHorizontal != null && invertItemRotationHorizontal.Value) { num2 = 0f - num2; } if (string.Equals(axisName, "Mouse Y", StringComparison.OrdinalIgnoreCase) && invertItemRotationVertical != null && invertItemRotationVertical.Value) { num2 = 0f - num2; } return num2; } private void MakePluginHostPersistent() { try { ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to mark plugin host persistent: " + ex.GetType().Name + ": " + ex.Message)); } } private void DrawContactInfo(ConfigEntryBase entry) { GUILayout.Label(entry.BoxedValue?.ToString() ?? "824639225", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); } private static ConfigDescription ConfigDescriptionWithOrder(string description, int order) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = order } }); } private static ConfigDescription ConfigDescriptionWithOrder(string description, AcceptableValueBase acceptableValues, int order) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new ConfigDescription(description, acceptableValues, new object[1] { new ConfigurationManagerAttributes { Order = order } }); } } internal sealed class ConfigurationManagerAttributes { public bool? ShowRangeAsPercent; public Action<ConfigEntryBase> CustomDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; }