using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
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("BetterThrowing")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterThrowing")]
[assembly: AssemblyTitle("BetterThrowing")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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;
}
}
}
namespace BetterThrowing
{
[BepInPlugin("BetterThrowing.nickklmao", "Better Throwing", "1.0.1")]
[ContentWarningPlugin("BetterThrowing.nickklmao", "1.0.1", true)]
internal class Loader : BaseUnityPlugin
{
private static float throwPower;
private static float chargeSpeed;
private static void UpdateHook(ILContext context)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(context);
for (int i = 0; i < 2; i++)
{
val.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, (MethodBase)AccessTools.PropertyGetter(typeof(Time), "deltaTime"))
});
if (i == 0)
{
int index = val.Index;
val.Index = index - 1;
val.Remove();
val.Emit<Loader>(OpCodes.Ldsfld, "throwPower");
index = val.Index;
val.Index = index + 1;
}
if (i == 1)
{
int index = val.Index;
val.Index = index + 1;
}
val.Emit<Loader>(OpCodes.Ldsfld, "chargeSpeed");
val.Emit(OpCodes.Mul);
}
}
private void Awake()
{
throwPower = ((BaseUnityPlugin)this).Config.Bind<int>("Better Throwing", "Throw Power", 1, "How far can you throw items? (1-10)").Value;
chargeSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Better Throwing", "Charge Speed", 1, "How fast can you charge your throw? (1-10)").Value;
throwPower = Mathf.Clamp(throwPower, 1f, 10f);
chargeSpeed = Mathf.Clamp(chargeSpeed, 1f, 10f);
InitializeHooks();
}
private void InitializeHooks()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
new ILHook((MethodBase)AccessTools.Method(typeof(PlayerItems), "Update", (Type[])null, (Type[])null), new Manipulator(UpdateHook));
}
}
}