Decompiled source of DailyFreeSpell v1.0.0

DailyFreeSpell.dll

Decompiled 13 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SuperFantasyKingdom;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("DailyFreeSpell")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b823ae10082a55c8f271cb8b08bef34628a7a155")]
[assembly: AssemblyProduct("Daily Free Spell")]
[assembly: AssemblyTitle("DailyFreeSpell")]
[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 DailyFreeSpell
{
	[BepInPlugin("ownly.dailyfreespell", "Daily Free Spell", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll();
			DaytimeManager.OnMorningStart += delegate
			{
				FreeSpell.available = true;
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Daily Free Spell loaded: first spell cast each day costs 0 faith");
		}
	}
	internal static class FreeSpell
	{
		internal static bool available = true;
	}
	[HarmonyPatch(typeof(SpellManager), "GetSpellCost")]
	internal static class Patch_GetSpellCost
	{
		private static bool Prefix(ref int __result)
		{
			if (FreeSpell.available)
			{
				__result = 0;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SpellManager), "Cast")]
	internal static class Patch_Cast
	{
		private static void Postfix()
		{
			FreeSpell.available = false;
		}
	}
}