using System;
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 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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("StormyWeatherFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a61d268a92acdf5bd44b22dc62c2f7f522421563")]
[assembly: AssemblyProduct("StormyWeatherFix")]
[assembly: AssemblyTitle("StormyWeatherFix")]
[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 StormyWeatherFix
{
[BepInPlugin("grug.lethalcompany.stormsrock", "StormyWeather Fix", "37.87.37")]
public class StormyPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static Action<Action<GrabbableObject>, GrabbableObject> <0>__GOBjectStartPatch;
public static Action<Action<StormyWeather>, StormyWeather> <1>__WeatherPatch;
public static Manipulator <2>__StormyILHook;
public static Action<Action<RoundManager>, RoundManager> <3>__GOBjectDestroyPatch;
}
public const string modGUID = "grug.lethalcompany.stormsrock";
public const string modName = "StormyWeather Fix";
public const string modVersion = "37.87.37";
public static ManualLogSource mls = null;
public static Hook? GrabbableObjectStartHook;
public static Hook? GrabbableObjectDestroyHook;
public static Hook? stormyWeatherUpdateHook;
public static ILHook? stormyWeatherILHook;
public static List<GrabbableObject> metalObjects = new List<GrabbableObject>();
public static StormyWeather? fixedWeather;
public void Awake()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
mls = ((BaseUnityPlugin)this).Logger;
GrabbableObjectStartHook = new Hook((MethodBase)typeof(GrabbableObject).GetMethod("Start", AccessTools.allDeclared), (Delegate)new Action<Action<GrabbableObject>, GrabbableObject>(GOBjectStartPatch));
stormyWeatherUpdateHook = new Hook((MethodBase)typeof(StormyWeather).GetMethod("Update", AccessTools.allDeclared), (Delegate)new Action<Action<StormyWeather>, StormyWeather>(WeatherPatch));
MethodInfo? method = typeof(StormyWeather).GetMethod("OnEnable", AccessTools.allDeclared);
object obj = <>O.<2>__StormyILHook;
if (obj == null)
{
Manipulator val = StormyILHook;
<>O.<2>__StormyILHook = val;
obj = (object)val;
}
stormyWeatherILHook = new ILHook((MethodBase)method, (Manipulator)obj);
GrabbableObjectDestroyHook = new Hook((MethodBase)typeof(RoundManager).GetMethod("DetectElevatorIsRunning", AccessTools.allDeclared), (Delegate)new Action<Action<RoundManager>, RoundManager>(GOBjectDestroyPatch));
}
public static void GOBjectDestroyPatch(Action<RoundManager> orig, RoundManager self)
{
orig(self);
for (int i = 0; i < metalObjects.Count; i++)
{
if ((Object)(object)metalObjects[i] == (Object)null)
{
metalObjects.RemoveAt(i);
}
}
}
public static void GOBjectStartPatch(Action<GrabbableObject> orig, GrabbableObject self)
{
if (self.itemProperties.isConductiveMetal)
{
metalObjects.Add(self);
}
orig(self);
}
public static void WeatherPatch(Action<StormyWeather> orig, StormyWeather self)
{
orig(self);
self.metalObjects = metalObjects;
}
public static void StormyILHook(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
val.GotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchCall<StormyWeather>(x, "GetMetalObjectsAfterDelay")
});
val.RemoveRange(5);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "StormyWeatherFix";
public const string PLUGIN_NAME = "StormyWeatherFix";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}