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 Unity.Netcode;
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("SlipperyShotgun")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+416f6f1adb232d40d6ea8a3b5376ed0de0047990")]
[assembly: AssemblyProduct("SlipperyShotgun")]
[assembly: AssemblyTitle("SlipperyShotgun")]
[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.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;
}
}
[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 SlipperyShotgun
{
public enum LogLevel
{
Debug,
Info,
None
}
[BepInPlugin("com.itekso.SlipperyShotgun", "SlipperyShotgun", "1.0.1")]
public class SlipperyShotgun : BaseUnityPlugin
{
[HarmonyPatch(typeof(ShotgunItem))]
public static class ShotgunItemPatch
{
[HarmonyPatch("ShootGunAndSync")]
[HarmonyPostfix]
public static void PostfixShootGunAndSync(ShotgunItem __instance)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)__instance).playerHeldBy.currentlyHeldObjectServer != (Object)null && Random.Range(1, 101) <= chanceToDropConfig.Value)
{
((GrabbableObject)__instance).playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
if (logLevelConfig.Value >= LogLevel.Info)
{
Logger.LogInfo((object)"Try putting more stats in to handling!");
}
}
}
}
private const string modGUID = "com.itekso.SlipperyShotgun";
private const string modName = "SlipperyShotgun";
private const string modVersion = "1.0.1";
private static ConfigEntry<int> chanceToDropConfig;
private static ConfigEntry<LogLevel> logLevelConfig;
private static Harmony harmonyInstance;
private static ManualLogSource Logger { get; set; }
private void Awake()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
chanceToDropConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ChanceToDrop", 40, new ConfigDescription("The chance (1%-100%) that the player will drop the gun when shooting it.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
logLevelConfig = ((BaseUnityPlugin)this).Config.Bind<LogLevel>("General", "LogLevel", LogLevel.Info, "Set the logging level.");
harmonyInstance = new Harmony("com.itekso.SlipperyShotgun");
Patch();
if (logLevelConfig.Value >= LogLevel.Info)
{
Logger.LogInfo((object)"SlipperyShotgun v1.0.1 has loaded!");
}
}
private static void Patch()
{
if (logLevelConfig.Value >= LogLevel.Debug)
{
Logger.LogDebug((object)"Oiling Up...");
}
harmonyInstance.PatchAll(typeof(ShotgunItemPatch));
if (logLevelConfig.Value >= LogLevel.Debug)
{
Logger.LogDebug((object)"Ooh, Shiny!");
}
}
internal static void Unpatch()
{
if (logLevelConfig.Value >= LogLevel.Debug)
{
Logger.LogDebug((object)"Cleaning Up...");
}
harmonyInstance.UnpatchSelf();
if (logLevelConfig.Value >= LogLevel.Debug)
{
Logger.LogDebug((object)"Dry and Crusty!");
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SlipperyShotgun";
public const string PLUGIN_NAME = "SlipperyShotgun";
public const string PLUGIN_VERSION = "1.0.0";
}
}