Decompiled source of QuickBoons v1.0.0

QuickBoons.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
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 HarmonyLib;

[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 QuickBoons;

[BepInPlugin("Tchernobill.QuickBoons", "QuickBoons", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Item), "Use", new Type[] { typeof(Character) })]
	public class Item_Use
	{
		private static bool Prefix(ref Item __instance, ref bool __result, ref Character _character)
		{
			Item obj = __instance;
			Skill val = (Skill)(object)((obj is Skill) ? obj : null);
			if (val != null && ((Item)val).ItemID == 8200300 && val.HasAllRequirements(false))
			{
				BoonCaller.invokeBoonsEffects(ref _character);
			}
			return true;
		}
	}

	public class BoonCaller
	{
		public static bool invokeBoonsEffects(ref Character _target)
		{
			bool result = false;
			IList<string> learnedActiveSkillUIDs = _target.Inventory.SkillKnowledge.GetLearnedActiveSkillUIDs();
			for (int i = 0; i < learnedActiveSkillUIDs.Count; i++)
			{
				string text = learnedActiveSkillUIDs[i];
				Item item = ItemManager.Instance.GetItem(text);
				Skill val = (Skill)(object)((item is Skill) ? item : null);
				if (val != null && toLookForSkills.Contains(((Item)val).ItemID) && val.HasAllRequirements(false))
				{
					result = true;
					((EffectSynchronizer)val).OnReceiveActivatedEffects(_target, text + "@2:0:;(0, 0, 0);(0, 0, 0);1");
					val.SkillStarted();
					((EffectSynchronizer)val).OnReceiveActivatedEffects(_target, text + "@1:0:;(0, 0, 0);(0, 0, 0);1");
					val.ConsumeResources();
				}
			}
			return result;
		}
	}

	public const string GUID = "Tchernobill.QuickBoons";

	public const string NAME = "QuickBoons";

	public const string VERSION = "1.0.0";

	public const int CallOfElements_ItemID = 8200300;

	public const int Enrage_ItemID = 8200110;

	public const int Focus_ItemID = 8200120;

	public const int Mist_ItemID = 8200170;

	public const int Blessed_ItemID = 8200180;

	public const int Possessed_ItemID = 8200190;

	public const int Cool_ItemID = 8200140;

	public const int Warm_ItemID = 8200130;

	public static IList<int> toLookForSkills = new List<int>();

	internal void Awake()
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		toLookForSkills.Add(8200170);
		toLookForSkills.Add(8200180);
		toLookForSkills.Add(8200190);
		toLookForSkills.Add(8200140);
		toLookForSkills.Add(8200130);
		new Harmony("Tchernobill.QuickBoons").PatchAll();
	}
}