Decompiled source of Anticipation Buff v1.1.0

plugins/AnticipationBuff.dll

Decompiled 4 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AnticipationBuff;

[BepInPlugin("johbenji.anticipationbuff", "Anticipation Buff", "1.0.0")]
public class AnticipationBuffPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(StatusEffect), "OnReceiveHit")]
	public class AnticipationBuffPatch
	{
		private static bool Prefix(StatusEffect __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)__instance.m_actionOnHit == 1 && __instance.m_identifierName == "Alert")
			{
				Character affectedCharacter = __instance.m_affectedCharacter;
				if ((Object)(object)affectedCharacter != (Object)null)
				{
					CharacterInventory inventory = affectedCharacter.Inventory;
					if ((Object)(object)inventory != (Object)null)
					{
						CharacterSkillKnowledge skillKnowledge = inventory.SkillKnowledge;
						if ((Object)(object)skillKnowledge != (Object)null && (Object)(object)((CharacterKnowledge)skillKnowledge).GetItemFromItemID(8205403) != (Object)null)
						{
							return false;
						}
					}
				}
			}
			return true;
		}
	}

	public const string GUID = "johbenji.anticipationbuff";

	public const string NAME = "Anticipation Buff";

	public const string VERSION = "1.0.0";

	internal static ManualLogSource Log;

	internal void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		new Harmony("johbenji.anticipationbuff").PatchAll();
	}
}