using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Rewritten;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Class1), "Rewritten", "1.0", "TheMrEvil", null)]
[assembly: MelonGame("Alvios", "Vellum")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Rewritten")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+74b033694745a56bd9ed159562a30e4776b548b8")]
[assembly: AssemblyProduct("Rewritten")]
[assembly: AssemblyTitle("Rewritten")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
namespace Rewritten
{
public class Class1 : MelonMod
{
private static int rerollsUsed;
public override void OnInitializeMelon()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
MelonLogger.Msg("Initializing Harmony patches...");
Harmony val = new Harmony("com.rewritten.mod");
try
{
val.Patch((MethodBase)AccessTools.Method("PlayerChoicePanel:TryReroll", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Class1), "TryRerollPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
MelonLogger.Msg("Harmony patches applied successfully");
}
catch (Exception ex)
{
MelonLogger.Error("Failed to apply Harmony patches: " + ex.Message);
}
}
public static void TryRerollPostfix(PlayerChoicePanel __instance)
{
MelonLogger.Msg("TryRerollPostfix called!");
if ((Object)(object)PlayerControl.myInstance != (Object)null)
{
int num = (int)((EntityControl)PlayerControl.myInstance).GetPassiveMod((EntityValue)392, 0f);
PlayerChoicePanel.RerollsUsed = Math.Max(0, num - 69);
rerollsUsed++;
MelonLogger.Msg("Rerolls Used: " + rerollsUsed);
}
}
}
}