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.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("GameAssembly")]
[assembly: IgnoresAccessChecksTo("SharedAssembly")]
[assembly: AssemblyCompany("ViViKo.BetterSwingPreview")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("BetterSwingPreview")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterSwingPreview")]
[assembly: AssemblyTitle("ViViKo.BetterSwingPreview")]
[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 BetterSwingPreview
{
[BepInPlugin("ViViKo.BetterSwingPreview", "BetterSwingPreview", "1.0.0")]
public class BetterSwingPreview : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("ViViKo.BetterSwingPreview");
public static BetterSwingPreview Instance;
internal static ManualLogSource Logger { get; private set; }
public static ConfigEntry<bool> TrajectoryShowOvercharge { get; private set; }
public static ConfigEntry<Color> TrajectoryDefaultColor { get; private set; }
public static ConfigEntry<Color> TrajectoryOverchargeColor { get; private set; }
public static ConfigEntry<float> TrajectoryWidth { get; private set; }
private void Awake()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
ConfigFile config = ((BaseUnityPlugin)this).Config;
TrajectoryShowOvercharge = config.Bind<bool>("TrajectoryPreview", "ShowOvercharge", true, "Show overcharge by changing trajectory preview color");
TrajectoryDefaultColor = config.Bind<Color>("TrajectoryPreview", "DefaultColor", new Color(1f, 1f, 1f), "Default color");
TrajectoryOverchargeColor = config.Bind<Color>("TrajectoryPreview", "OverchargeColor", new Color(1f, 0.749f, 0.7647f), "Overcharge color");
TrajectoryWidth = config.Bind<float>("TrajectoryPreview", "Width", 0.25f, new ConfigDescription("Trajectory Line Width", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>()));
harmony.PatchAll();
Logger.LogInfo((object)"Plugin BetterSwingPreview v1.0.0 is loaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ViViKo.BetterSwingPreview";
public const string PLUGIN_NAME = "BetterSwingPreview";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BetterSwingPreview.Patches
{
[HarmonyPatch(typeof(PlayerGolfer))]
internal class PlayerGolferPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void AwakePatch(PlayerGolfer __instance)
{
SingletonBehaviour<SwingTrajectoryPreview>.instance.lineRenderer.startWidth = BetterSwingPreview.TrajectoryWidth.Value;
SingletonBehaviour<SwingTrajectoryPreview>.instance.lineRenderer.endWidth = BetterSwingPreview.TrajectoryWidth.Value;
}
[HarmonyPatch("OnBUpdate")]
[HarmonyPostfix]
private static void OnBUpdatePatch(PlayerGolfer __instance)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)__instance).isLocalPlayer && BetterSwingPreview.TrajectoryShowOvercharge.Value)
{
bool flag = __instance.IsChargingSwing && __instance.SwingNormalizedPower > 1f;
SingletonBehaviour<SwingTrajectoryPreview>.instance.lineRenderer.endColor = (flag ? BetterSwingPreview.TrajectoryOverchargeColor.Value : BetterSwingPreview.TrajectoryDefaultColor.Value);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}