using System;
using System.Collections;
using System.Collections.Generic;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreShipUpgrades.Misc.Upgrades;
using MoreShipUpgrades.Misc.Util;
using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Items.Shotgun;
using PiggysVarietyMod.Items;
using SleightOfHandPiggyVarietyPatch.NetcodePatcher;
using SleightOfHandPiggyVarietyPatch.Patches;
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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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 SleightOfHandPiggyVarietyPatch
{
[BepInPlugin("com.github.WhiteSpike.SleightOfHandPiggyVarietyPatch", "Sleight Of Hand Piggy Variety Patch", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static readonly Harmony harmony = new Harmony("com.github.WhiteSpike.SleightOfHandPiggyVarietyPatch");
internal static readonly ManualLogSource mls = Logger.CreateLogSource("Sleight Of Hand Piggy Variety Patch");
private void Awake()
{
harmony.PatchAll(typeof(M4ItemPatcher));
mls.LogInfo((object)"Patched the rifle succesfully");
mls.LogInfo((object)"Sleight Of Hand Piggy Variety Patch 1.0.3 has been loaded successfully.");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SleightOfHandPiggyVarietyPatch";
public const string PLUGIN_NAME = "SleightOfHandPiggyVarietyPatch";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace SleightOfHandPiggyVarietyPatch.Patches
{
[HarmonyPatch(typeof(RifleScript))]
internal static class M4ItemPatcher
{
[CompilerGenerated]
private sealed class <>c__DisplayClass2_0
{
public RifleScript gun;
internal bool <waitToEndReloadAnimation>b__0()
{
return gun.isReloading;
}
}
[CompilerGenerated]
private sealed class <waitToEndReloadAnimation>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RifleScript gun;
private <>c__DisplayClass2_0 <>8__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <waitToEndReloadAnimation>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass2_0();
<>8__1.gun = gun;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = (object)new WaitWhile((Func<bool>)(() => <>8__1.gun.isReloading));
<>1__state = 2;
return true;
case 2:
{
<>1__state = -1;
Animator playerBodyAnimator = ((GrabbableObject)<>8__1.gun).playerHeldBy.playerBodyAnimator;
playerBodyAnimator.speed /= 2f + SleightOfHand.ComputeSleightOfHandSpeedBoost();
Animator gunAnimator = <>8__1.gun.gunAnimator;
gunAnimator.speed /= 2f + SleightOfHand.ComputeSleightOfHandSpeedBoost();
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPatch("FinishReloadCoroutine")]
[HarmonyPrefix]
private static void FinishReloadCoroutinePrefix(RifleScript __instance)
{
if (BaseUpgrade.GetActiveUpgrade("Sleight of Hand"))
{
Animator playerBodyAnimator = ((GrabbableObject)__instance).playerHeldBy.playerBodyAnimator;
playerBodyAnimator.speed *= 2f + SleightOfHand.ComputeSleightOfHandSpeedBoost();
Animator gunAnimator = __instance.gunAnimator;
gunAnimator.speed *= 2f + SleightOfHand.ComputeSleightOfHandSpeedBoost();
((MonoBehaviour)__instance).StartCoroutine(__instance.waitToEndReloadAnimation());
}
}
[HarmonyPatch("StartReload")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> StartReloadTranspiler(IEnumerable<CodeInstruction> instructions)
{
MethodInfo method = typeof(SleightOfHand).GetMethod("GetSleightOfHandSpeedBoost");
List<CodeInstruction> result = new List<CodeInstruction>(instructions);
int num = 0;
Tools.FindLocalField(ref num, ref result, 0, (object)method, false, false, false, "Not found");
return result;
}
[IteratorStateMachine(typeof(<waitToEndReloadAnimation>d__2))]
private static IEnumerator waitToEndReloadAnimation(this RifleScript gun)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <waitToEndReloadAnimation>d__2(0)
{
gun = gun
};
}
}
}
namespace SleightOfHandPiggyVarietyPatch.Misc
{
internal static class Metadata
{
public const string GUID = "com.github.WhiteSpike.SleightOfHandPiggyVarietyPatch";
public const string NAME = "Sleight Of Hand Piggy Variety Patch";
public const string VERSION = "1.0.3";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace SleightOfHandPiggyVarietyPatch.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}