using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[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 = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("UnfairAutoFlips")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UnfairAutoFlips")]
[assembly: AssemblyTitle("UnfairAutoFlips")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 UnfairAutoFlips
{
[BepInPlugin("com.raef.unfairflips.autoflip", "Unfair Auto Flips", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "com.raef.unfairflips.autoflip";
public const string PluginName = "Unfair Auto Flips";
public const string PluginVersion = "1.0.2";
internal static ManualLogSource Log;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("com.raef.unfairflips.autoflip");
val.PatchAll();
Log.LogInfo((object)"Unfair Auto Flips loaded.");
}
}
[HarmonyPatch]
internal static class CoinFlipUpdatePatch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(AccessTools.TypeByName("CoinFlip"), "Update", (Type[])null, (Type[])null);
}
private static void Postfix(object __instance)
{
try
{
Type type = __instance.GetType();
bool flag = (bool)AccessTools.Field(type, "flipBlocked").GetValue(__instance);
bool flag2 = (bool)AccessTools.Field(type, "isFlipping").GetValue(__instance);
float num = (float)AccessTools.Field(type, "timeSinceMoved").GetValue(__instance);
bool flag3 = (bool)AccessTools.Field(type, "bigMoment").GetValue(__instance);
bool flag4 = (bool)AccessTools.Field(type, "flippedThisSession").GetValue(__instance);
if (!flag && !flag2 && num > 1f && !flag3 && flag4)
{
AccessTools.Method(type, "DoFlip", (Type[])null, (Type[])null).Invoke(__instance, null);
}
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Auto-flip failed: {arg}");
}
}
}
}