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 Mirror;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("UpgradeWaitSkipPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Upgrade Wait Skip Plugin")]
[assembly: AssemblyTitle("UpgradeWaitSkipPlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 UpgradeWaitSkipPlugin
{
[HarmonyPatch]
public static class MiggyHost_RogueLikeUpgradeMenu
{
private static readonly HashSet<RogueLikeUpgradeMenu> LocallyReleased = new HashSet<RogueLikeUpgradeMenu>();
[HarmonyPatch(typeof(RogueLikeUpgradeMenu), "OnUpgradeDraftGenerated")]
[HarmonyPostfix]
private static void OnUpgradeDraftGenerated_Postfix(RogueLikeUpgradeMenu __instance)
{
LocallyReleased.Remove(__instance);
}
[HarmonyPatch(typeof(RogueLikeUpgradeMenu), "OnUpgradeClicked")]
[HarmonyPostfix]
private static void OnUpgradeClicked_Postfix(RogueLikeUpgradeMenu __instance)
{
if ((NetworkServer.active && NetworkClient.active) || !__instance.IsUpgradeSelected || !LocallyReleased.Add(__instance))
{
return;
}
MethodInfo methodInfo = AccessTools.Method(typeof(RogueLikeUpgradeMenu), "HideUpgradeScreen", (Type[])null, (Type[])null);
if (methodInfo == null)
{
Debug.LogError((object)"[MiggyHost] Could not find RogueLikeUpgradeMenu.HideUpgradeScreen()!");
LocallyReleased.Remove(__instance);
return;
}
IEnumerator enumerator = (IEnumerator)methodInfo.Invoke(__instance, null);
if (enumerator == null)
{
Debug.LogError((object)"[MiggyHost] HideUpgradeScreen() returned null!");
LocallyReleased.Remove(__instance);
}
else
{
((MonoBehaviour)__instance).StartCoroutine(enumerator);
Debug.Log((object)"[MiggyHost] Locally released player from RogueLike upgrade screen.");
}
}
[HarmonyPatch(typeof(RogueLikeUpgradeMenu), "OnScreenClosed")]
[HarmonyPostfix]
private static void OnScreenClosed_Postfix(RogueLikeUpgradeMenu __instance)
{
LocallyReleased.Remove(__instance);
}
}
[BepInPlugin("com.miggy.upgradewaitskip", "Miggy Upgrade Wait Skip", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private Harmony _harmony;
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
_harmony = new Harmony("com.miggy.upgradewaitskip");
_harmony.PatchAll();
Logger.LogInfo((object)"Miggy Upgrade Wait Skip is loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "UpgradeWaitSkipPlugin";
public const string PLUGIN_NAME = "Upgrade Wait Skip Plugin";
public const string PLUGIN_VERSION = "1.0.0";
}
}