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 UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;
[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("YEET")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("YEET")]
[assembly: AssemblyTitle("YEET")]
[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 YEET
{
internal static class MyPluginInfo
{
internal const string PLUGIN_GUID = "id107.yeet";
internal const string PLUGIN_NAME = "YEET";
internal const string PLUGIN_VERSION = "0.0.0";
}
[BepInPlugin("id107.yeet", "YEET", "0.0.0")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "id107.yeet");
Configs.Load(this);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin id107.yeet is loaded!");
}
}
[HarmonyPatch(typeof(CarryableInteract))]
internal class CarryableInteractPatch
{
[HarmonyPostfix]
[HarmonyPatch("StartThrow")]
private static void StartThrow(ref float ___throwStartTime, float ___maxThrowDuration)
{
if (Configs.throwTypeConfig.Value == Configs.ThrowType.maxThrow)
{
___throwStartTime -= ___maxThrowDuration;
}
}
[HarmonyPrefix]
[HarmonyPatch("DelayedEndThrow")]
private static void DelayedEndThrow(ref float ___throwStartTime, float ___maxThrowDuration)
{
if (Configs.throwTypeConfig.Value == Configs.ThrowType.reverseChargedThrow)
{
float num = Mathf.Clamp(Time.time - ___throwStartTime, 0f, ___maxThrowDuration);
num = ___maxThrowDuration - num;
___throwStartTime = Time.time - num;
}
}
[HarmonyPrefix]
[HarmonyPatch("Update")]
private static void UpdatePrefix(bool ____isChargingThrow, ref float ___throwStartTime, float ___maxThrowDuration, out float __state)
{
__state = ___throwStartTime;
if (____isChargingThrow && Configs.throwTypeConfig.Value == Configs.ThrowType.reverseChargedThrow)
{
float num = Mathf.Clamp01((Time.time - ___throwStartTime) / ___maxThrowDuration);
num = 1f - num;
___throwStartTime = Time.time - num * ___maxThrowDuration;
}
}
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void UpdatePostfix(bool ____isChargingThrow, ref float ___throwStartTime, float __state)
{
if (____isChargingThrow && Configs.throwTypeConfig.Value == Configs.ThrowType.reverseChargedThrow)
{
___throwStartTime = __state;
}
}
}
internal class Configs
{
internal enum ThrowType
{
chargedThrow,
reverseChargedThrow,
maxThrow
}
internal static ConfigEntry<ThrowType> throwTypeConfig;
internal static void Load(BepinPlugin plugin)
{
throwTypeConfig = ((BaseUnityPlugin)plugin).Config.Bind<ThrowType>("YEET", "ThrowType", ThrowType.reverseChargedThrow, (ConfigDescription)null);
}
}
internal class GUI : ModSettingsMenu
{
public override string Name()
{
return "YEET";
}
public override void Draw()
{
bool flag = Configs.throwTypeConfig.Value == Configs.ThrowType.chargedThrow;
if (GUITools.DrawCheckbox("Charged throw", ref flag))
{
Configs.throwTypeConfig.Value = Configs.ThrowType.chargedThrow;
}
flag = Configs.throwTypeConfig.Value == Configs.ThrowType.reverseChargedThrow;
if (GUITools.DrawCheckbox("Reverse-charged throw", ref flag))
{
Configs.throwTypeConfig.Value = Configs.ThrowType.reverseChargedThrow;
}
flag = Configs.throwTypeConfig.Value == Configs.ThrowType.maxThrow;
if (GUITools.DrawCheckbox("YEET", ref flag))
{
Configs.throwTypeConfig.Value = Configs.ThrowType.maxThrow;
}
}
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)3;
public override string Author => "18107";
public override string Description => "Throw all items with maximum force without charging the throw";
}
}