using System;
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;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FreeCastingPlugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FreeCastingPlugin")]
[assembly: AssemblyTitle("FreeCastingPlugin")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace FreeCastingPlugin
{
[BepInPlugin("FreeCastingPlugin", "FreeCastingPlugin", "1.0.0")]
[BepInDependency("com.magearena.modsync", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static string modsync = "all";
private static ManualLogSource loggerReference = null;
private void Awake()
{
loggerReference = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin FreeCastingPlugin is loaded!");
Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
}
[HarmonyPatch(typeof(PlayerInventory), "cFireball")]
[HarmonyPatch(typeof(PlayerInventory), "cFrostbolt")]
[HarmonyPatch(typeof(PlayerInventory), "cCasthole")]
[HarmonyPatch(typeof(PlayerInventory), "cCastWard")]
[HarmonyPatch(typeof(PlayerInventory), "cCastworm")]
[HarmonyILManipulator]
public static void RemoveCurrentPageCheck(ILContext il, MethodBase original)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = default(ILLabel);
if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<MageBookController>(x, "LastPressedPage"),
(Instruction x) => true,
(Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref val2)
}))
{
loggerReference.LogError((object)("Unable to patch spellbook page check for " + original.Name + " because the relevant instructions were not found"));
return;
}
int index = val.Index;
val.Index = index - 1;
val.Remove();
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Pop);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "FreeCastingPlugin";
public const string PLUGIN_NAME = "FreeCastingPlugin";
public const string PLUGIN_VERSION = "1.0.0";
}
}