Decompiled source of GnomesOnlyGiveSpellPages v1.0.0

Plugins/Gnomes Only Give Spellpages.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Gnomes Only Give Spellpages")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Gnomes Only Give Spellpages")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("372add71-342e-437a-b6cf-137d8e586699")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("wilson.gnomesonlygivespellpages", "Gnomes Only Give Spellpages", "1.0.0")]
[BepInProcess("MageArena.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class GnomesOnlyGiveSpellpagesPlugin : BaseUnityPlugin
{
	public static string modsync = "all";

	private void Awake()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		((BaseUnityPlugin)this).Logger.LogInfo((object)"ModSync found! Initializing mod...");
		new Harmony("wilson.gnomesonlygivespellpages").PatchAll();
	}
}
[HarmonyPatch(typeof(DuendeManager), "TradeItem")]
internal class Patch_TradeItem_ForcePage
{
	private static bool Prefix(DuendeManager __instance, int DuendeID)
	{
		object value = typeof(DuendeManager).GetField("plt", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
		object[] array = value.GetType().GetField("Pages", BindingFlags.Instance | BindingFlags.Public).GetValue(value) as object[];
		int num = Random.Range(0, array.Length);
		typeof(DuendeManager).GetMethod("ServerCreatePage", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, new object[2] { DuendeID, num });
		return false;
	}
}